mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
docs(examples): Generalize key-value example
This commit is contained in:
parent
dbe8c0c957
commit
a8ffebbab9
4 changed files with 8 additions and 8 deletions
|
@ -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]]
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue