docs(examples): Generalize key-value example

This commit is contained in:
Ed Page 2022-03-14 09:37:52 -05:00
parent dbe8c0c957
commit a8ffebbab9
4 changed files with 8 additions and 8 deletions

View file

@ -166,7 +166,7 @@ name = "git-derive"
required-features = ["derive"] required-features = ["derive"]
[[example]] [[example]]
name = "keyvalue-derive" name = "typed-derive"
required-features = ["derive"] required-features = ["derive"]
[[example]] [[example]]

View file

@ -1,7 +1,7 @@
# Examples # Examples
- Basic demo: [derive](demo.md) - Basic demo: [derive](demo.md)
- Key-value pair arguments: [derive](keyvalue-derive.md) - Typed arguments: [derive](typed-derive.md)
- Topics: - Topics:
- Custom `parse()` - Custom `parse()`
- Custom cargo command: [builder](cargo-example.md), [derive](cargo-example-derive.md) - Custom cargo command: [builder](cargo-example.md), [derive](cargo-example-derive.md)

View file

@ -1,28 +1,28 @@
*Jump to [source](keyvalue-derive.rs)* *Jump to [source](typed-derive.rs)*
**This requires enabling the `derive` feature flag.** **This requires enabling the `derive` feature flag.**
```console ```console
$ keyvalue-derive --help $ typed-derive --help
clap clap
USAGE: USAGE:
keyvalue-derive[EXE] [OPTIONS] typed-derive[EXE] [OPTIONS]
OPTIONS: OPTIONS:
-D <DEFINES> -D <DEFINES>
-h, --help Print help information -h, --help Print help information
$ keyvalue-derive -D Foo=10 -D Alice=30 $ typed-derive -D Foo=10 -D Alice=30
Args { defines: [("Foo", 10), ("Alice", 30)] } Args { defines: [("Foo", 10), ("Alice", 30)] }
$ keyvalue-derive -D Foo $ typed-derive -D Foo
? failed ? failed
error: Invalid value "Foo" for '-D <DEFINES>': invalid KEY=value: no `=` found in `Foo` error: Invalid value "Foo" for '-D <DEFINES>': invalid KEY=value: no `=` found in `Foo`
For more information try --help For more information try --help
$ keyvalue-derive -D Foo=Bar $ typed-derive -D Foo=Bar
? failed ? failed
error: Invalid value "Foo=Bar" for '-D <DEFINES>': invalid digit found in string error: Invalid value "Foo=Bar" for '-D <DEFINES>': invalid digit found in string