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"]
[[example]]
name = "keyvalue-derive"
name = "typed-derive"
required-features = ["derive"]
[[example]]

View file

@ -1,7 +1,7 @@
# Examples
- Basic demo: [derive](demo.md)
- Key-value pair arguments: [derive](keyvalue-derive.md)
- Typed arguments: [derive](typed-derive.md)
- Topics:
- Custom `parse()`
- 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.**
```console
$ keyvalue-derive --help
$ typed-derive --help
clap
USAGE:
keyvalue-derive[EXE] [OPTIONS]
typed-derive[EXE] [OPTIONS]
OPTIONS:
-D <DEFINES>
-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)] }
$ keyvalue-derive -D Foo
$ typed-derive -D Foo
? failed
error: Invalid value "Foo" for '-D <DEFINES>': invalid KEY=value: no `=` found in `Foo`
For more information try --help
$ keyvalue-derive -D Foo=Bar
$ typed-derive -D Foo=Bar
? failed
error: Invalid value "Foo=Bar" for '-D <DEFINES>': invalid digit found in string