Skip to content

Commit 926bafe

Browse files
committed
docs(cookbook): Hint at overriding value_name
1 parent 29b946f commit 926bafe

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/typed-derive/fn_parser.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ $ typed-derive fn-parser --help
44
Usage: typed-derive fn-parser [OPTIONS]
55

66
Options:
7-
-D <DEFINES> Hand-written parser for tuples
8-
-h, --help Print help
7+
-D <KEY=VALUE> Hand-written parser for tuples
8+
-h, --help Print help
99

1010
```
1111

@@ -16,13 +16,13 @@ FnParser(FnParser { defines: [("Foo", 10), ("Alice", 30)] })
1616

1717
$ typed-derive fn-parser -D Foo
1818
? failed
19-
error: invalid value 'Foo' for '-D <DEFINES>': invalid KEY=value: no `=` found in `Foo`
19+
error: invalid value 'Foo' for '-D <KEY=VALUE>': invalid KEY=value: no `=` found in `Foo`
2020

2121
For more information, try '--help'.
2222

2323
$ typed-derive fn-parser -D Foo=Bar
2424
? failed
25-
error: invalid value 'Foo=Bar' for '-D <DEFINES>': invalid digit found in string
25+
error: invalid value 'Foo=Bar' for '-D <KEY=VALUE>': invalid digit found in string
2626

2727
For more information, try '--help'.
2828

examples/typed-derive/fn_parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clap::Args;
55
#[derive(Args, Debug)]
66
pub(crate) struct FnParser {
77
/// Hand-written parser for tuples
8-
#[arg(short = 'D', value_parser = parse_key_val::<String, i32>)]
8+
#[arg(short = 'D', value_name = "KEY=VALUE", value_parser = parse_key_val::<String, i32>)]
99
defines: Vec<(String, i32)>,
1010
}
1111

0 commit comments

Comments
 (0)