A Serde-based document converter.
You can install reserde
using Cargo:
cmd
cargo install reserde
sh
reserde --help
```txt reserde 0.0.3 Transcode a self-describing format into a different format.
Currently supports Bencode, Bincode (--out only), CBOR, JSON (--pretty), TAML (--in only), XML, x-www-form-urlencoded (as urlencoded) and YAML. All names are lowercase.
USAGE:
reserde.exe [FLAGS] [OPTIONS] --in
FLAGS:
--enum-bools
case-insensitively convert unit variants with name true
or false
into booleans
-h, --help
Prints help information
-p
pretty-print (where supported)
-V, --version
Prints version information
OPTIONS:
--if
-i, --in <in-format>
what to read [possible values: bencode, cbor, json, taml, urlencoded, xml, yaml]
--of <out-file>
where to write output to. Defaults to stdout
-o, --out <out-format>
what to write [possible values: bencode, bincode, cbor, json, urlencoded, xml, yaml]
-s <stringify>...
stringify bytes and non-string value keys into strings where possible. (Tries encodings in the order
specified.) [try with: --in bencode] [possible values: utf8]
```
.torrent
filesh
reserde -i bencode -o json --stringify utf8 --if manjaro-xfce-21.0.7-210614-linux510.iso.torrent
Output (excerpt):
json
{
"announce": "udp://tracker.opentrackr.org:1337",
"created by": "mktorrent 1.1",
"creation date": 1623684209,
"info": {
"length": 2600828928,
"name": "manjaro-xfce-21.0.7-210614-linux510.iso",
"piece length": 2097152,
"pieces": [
128,
236,
36,
37,
10,
…
]
},
"url-list": "https://download.manjaro.org/xfce/21.0.7/mfce/21.0.7/manjaro-xfce-21.0.7-210614-linux51anjaro-xfce-21.0.7-210614-linux510.iso"
}
sh
reserde -i taml -o yaml
```taml
// Sewer
"$sewer/ambdrips", 0.8 "$sewer/ambflies", 0.1 "$sewer/amb_hum", 0.05 // postfix comment
sound: "$sewer/moments/*" layers: 1 first-interval-no-min: true interval-range: (10, 60) volume-range: (0.1, 0.15)
spaced \
identifier`: "asdhasd kjhdajkh"
```
soundscapes: - loops: - sound: $sewer/ambdrips volume: 0.8 - sound: $sewer/ambflies volume: 0.1 - sound: $sewer/amb_hum volume: 0.05 moments: - sound: $sewer/moments/* layers: 1 first-interval-no-min: true interval-range: - 10 - 60 volume-range: - 0.1 - 0.15 "spaced ` identifier": asdhasd kjhdajkh ```
(Comments are generally stripped, as they can't be sent across Serde's interface.)
sh
reserde -i taml -o xml
```taml
field1: true field2: false
Tuple(1, 2, 3) Unit EmptyTuple() ```
xml
<enums><Structured field_1="true" field_2="false"/><Tuple>1</Tuple><Tuple>2</Tuple><Tuple>3</Tuple><Unit/></enums>
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING for more information.
reserde
strictly follows Semantic Versioning 2.0.0 with the following exceptions:
This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.
Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.
Note that dependencies of this crate may have a more lenient MSRV policy!
Please use cargo +nightly update -Z minimal-versions
in your automation if you don't generate Cargo.lock manually (or as necessary) and require support for a compiler older than current stable.