Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove json command #640

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

* #639 Remove `xml` command
* #640 Remove `json` command

## [0.17.0] - 2023-06-30

Expand Down
36 changes: 0 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ $ cargo install --git https://github.com/deutsche-nationalbibliothek/pica-rs --t
| [select](#select) | beta | select subfield values from records |
| [slice](#slice) | stable | return records withing a range (half-open interval) |
| [split](#split) | stable | split a list of records into chunks |
| [json](#json) | depricated | serialize records in JSON |

## Usage

Expand Down Expand Up @@ -345,41 +344,6 @@ outdir
├── ...
```

### JSON

This command serializes the internal representation of record to JSON:

```bash
$ echo -e "003@ \x1f0123456789\x1fab\x1e" | pica json | jq .
[
{
"fields": [
{
"name": "003@",
"subfields": [
{
"name": "0",
"value": "123456789"
},
{
"name": "a",
"value": "b"
}
]
}
]
}
]
```

The result can be processed with other tools and programming languages.
To get [PICA JSON](http://format.gbv.de/pica/json) format you can pipe
the result to this [jq](https://stedolan.github.io/jq/) command:

```bash
jq -c '.[]|.fields|map([.tag,.occurrence]+(.subfields|map(.tag,.value)))'
```

## Related Projects

- [Catmandu::Pica](https://metacpan.org/pod/Catmandu::PICA) - Catmandu modules for working with PICA+ data
Expand Down
1 change: 0 additions & 1 deletion docs/book/src/de/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
- [select]()
- [slice]()
- [split]()
- [json]()

# Tutorials

Expand Down
91 changes: 0 additions & 91 deletions src/bin/pica/commands/json.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/bin/pica/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod filter;
mod frequency;
mod hash;
mod invalid;
mod json;
mod partition;
mod print;
mod sample;
Expand All @@ -22,7 +21,6 @@ pub(crate) use filter::{Filter, FilterConfig};
pub(crate) use frequency::{Frequency, FrequencyConfig};
pub(crate) use hash::{Hash, HashConfig};
pub(crate) use invalid::Invalid;
pub(crate) use json::{Json, JsonConfig};
pub(crate) use partition::{Partition, PartitionConfig};
pub(crate) use print::{Print, PrintConfig};
pub(crate) use sample::{Sample, SampleConfig};
Expand Down
1 change: 0 additions & 1 deletion src/bin/pica/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub(crate) struct Config {
pub(crate) filter: Option<FilterConfig>,
pub(crate) frequency: Option<FrequencyConfig>,
pub(crate) hash: Option<HashConfig>,
pub(crate) json: Option<JsonConfig>,
pub(crate) partition: Option<PartitionConfig>,
pub(crate) print: Option<PrintConfig>,
pub(crate) sample: Option<SampleConfig>,
Expand Down
6 changes: 1 addition & 5 deletions src/bin/pica/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::{io, process};
use clap::{CommandFactory, Parser, Subcommand};
use commands::{
Cat, Completions, Convert, Count, Filter, Frequency, Hash, Invalid,
Json, Partition, Print, Sample, Select, Slice, Split,
Partition, Print, Sample, Select, Slice, Split,
};
use config::Config;
use util::{CliError, CliResult};
Expand Down Expand Up @@ -49,9 +49,6 @@ enum Commands {
Frequency(Frequency),
Hash(Hash),
Invalid(Invalid),

/// Serialize records to JSON
Json(Json),
Partition(Partition),
Print(Print),

Expand All @@ -77,7 +74,6 @@ fn run() -> CliResult<()> {
Commands::Frequency(cmd) => cmd.run(&config),
Commands::Hash(cmd) => cmd.run(&config),
Commands::Invalid(cmd) => cmd.run(&config),
Commands::Json(cmd) => cmd.run(&config),
Commands::Partition(cmd) => cmd.run(&config),
Commands::Print(cmd) => cmd.run(&config),
Commands::Sample(cmd) => cmd.run(&config),
Expand Down
Loading
Loading