Skip to content

Commit

Permalink
docs(readme): rm .py ext from usage, examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dbohdan committed Oct 7, 2023
1 parent 5f731f6 commit f89bfa3
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ python3 -m pip install --user git+https://github.com/remarshal-project/remarshal
## Usage

```
usage: remarshal.py [-h] [-v] [-i input] [--if {cbor,json,msgpack,toml,yaml}]
[--json-indent n] [-k] [--max-values n] [-o output]
[--of {cbor,json,msgpack,toml,yaml}] [-s] [--unwrap key]
[--verbose] [--wrap key] [--yaml-indent n]
[--yaml-style {,',",|,>}] [--yaml-width n]
[input] [output]
usage: remarshal [-h] [-v] [-i input] [--if {cbor,json,msgpack,toml,yaml}]
[--json-indent n] [-k] [--max-values n] [-o output]
[--of {cbor,json,msgpack,toml,yaml}] [-s] [--unwrap key]
[--verbose] [--wrap key] [--yaml-indent n]
[--yaml-style {,',",|,>}] [--yaml-width n]
[input] [output]
Convert between CBOR, JSON, MessagePack, TOML, and YAML.
Expand All @@ -74,9 +74,9 @@ options:
-v, --version show program's version number and exit
-i input, --input input
input file
--if {cbor,json,msgpack,toml,yaml}, --input-format
{cbor,json,msgpack,toml,yaml}, -f {cbor,json,msgpack,toml,yaml},
--from {cbor,json,msgpack,toml,yaml}
--if {cbor,json,msgpack,toml,yaml}, --input-format
{cbor,json,msgpack,toml,yaml}, -f {cbor,json,msgpack,toml,yaml}, --from
{cbor,json,msgpack,toml,yaml}
input format
--json-indent n JSON indentation
-k, --stringify turn into strings boolean, date-time, and null keys
Expand All @@ -85,9 +85,9 @@ options:
1000000, negative for unlimited)
-o output, --output output
output file
--of {cbor,json,msgpack,toml,yaml}, --output-format
{cbor,json,msgpack,toml,yaml}, -t {cbor,json,msgpack,toml,yaml},
--to {cbor,json,msgpack,toml,yaml}
--of {cbor,json,msgpack,toml,yaml}, --output-format
{cbor,json,msgpack,toml,yaml}, -t {cbor,json,msgpack,toml,yaml}, --to
{cbor,json,msgpack,toml,yaml}
output format
-s, --sort-keys sort JSON, TOML, YAML keys instead of preserving key
order
Expand Down Expand Up @@ -117,31 +117,31 @@ If the top-level element is not a dictionary or does not have the key "someKey",
The following shell transcript demonstrates the problem and how `--wrap` and `--unwrap` solve it:

```
$ echo '[{"a":"b"},{"c":[1,2,3]}]' | ./remarshal.py --if json --of toml
$ echo '[{"a":"b"},{"c":[1,2,3]}]' | remarshal --if json --of toml
Error: cannot convert non-dictionary data to TOML; use "wrap" to wrap it in a dictionary
$ echo '[{"a":"b"},{"c":[1,2,3]}]' \
| ./remarshal.py --if json --of toml --wrap main
| remarshal --if json --of toml --wrap main
[[main]]
a = "b"
[[main]]
c = [1, 2, 3]
$ echo '[{"a":"b"},{"c":[1,2,3]}]' \
| ./remarshal.py --if json --wrap main - test.toml
| remarshal --if json --wrap main - test.toml
$ ./remarshal.py test.toml --of json
$ remarshal test.toml --of json
{"main":[{"a":"b"},{"c":[1,2,3]}]}
$ ./remarshal.py test.toml --of json --unwrap main
$ remarshal test.toml --of json --unwrap main
[{"a":"b"},{"c":[1,2,3]}]
```

## Examples

```
$ ./remarshal.py example.toml --of yaml
$ remarshal example.toml --of yaml
clients:
data:
- - gamma
Expand Down Expand Up @@ -182,8 +182,8 @@ servers:
ip: 10.0.0.2
title: TOML Example
$ curl -s http://api.openweathermap.org/data/2.5/weather\?q\=Kiev,ua \
| ./remarshal.py --if json --of toml
$ curl -s 'http://api.openweathermap.org/data/2.5/weather?q=Kiev,ua' \
| remarshal --if json --of toml
base = "cmc stations"
cod = 200
dt = 1412532000
Expand Down

0 comments on commit f89bfa3

Please sign in to comment.