Crates.io | itch |
lib.rs | itch |
version | 0.2.2 |
source | src |
created_at | 2021-04-10 22:35:57.346104 |
updated_at | 2024-10-04 16:52:13.573776 |
description | A cli tool for InTerCHanging between different serialized data formats |
homepage | https://github.com/FreddieGilbraith/itch |
repository | https://github.com/FreddieGilbraith/itch |
max_upload_size | |
id | 381817 |
size | 32,757 |
InTerCHanges one data format into another (get it?)
A very simple cli to convert between some of the most common plain-text data formats. It can't perform every conversion that might be theoretically possible, but it tries its best
itch
currently does not offer binary downloads, and must instead be built from source. You can use rustup to get the rust toolchain, the run the following command to download and install itch:
cargo install --force --git https://github.com/FreddieRidell/itch.git
USAGE:
itch [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-f, --from <from-type> Format of the input, will be derived if possible
-i, --input <input> Path to the input file, leave empty for stdin
-o, --output <output> Path to the output file, leave empty for stdout
-t, --to <to-type> Format of the output, will be derived if possible
itch
can take input from a file or std in, and output to a file or std out. If given a file as input or output it will try to detect the format automatically. itch
doesn't do any manipulation to data to satisfy the different constructs that different formats can express; so there's no guarantee that a conversion will work.
Can all be pretty reliably used as sources and targets
Somewhat unreliable, but can be used for basic transformations
itch
should always produce the same output when given the same input:
input
echo '<element key="value"><child/></element>'
| itch -f xml -t json
output
{ "key": "value", "child": {} }
itch
will not necessarily produce output that can automatically be reversed:
input
echo '<element key="value"><child/></element>'
| itch -f xml -t json
| itch -f json -t xml
output
<key>value</key><child></child>
Uses serde and it's own internal data representation format to act as an intermediary between the different data formats:
enum Itch {
Obj(IndexMap<String, Itch>),
Array(Vec<Itch>),
Bool(bool),
Int(i64),
Float(f64),
Text(String),
}
Each deserialization step converts to this type, and each serialisation step converts from it.