mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 06:42:33 +00:00
7110401595
This just affects how it's rendered; rather than attempting to highlight these blocks as a shell script, they'll get highlighted as console output. See the rendered versions for a better comparison.
47 lines
935 B
Markdown
47 lines
935 B
Markdown
*Jump to [source](custom-bool.rs)*
|
|
|
|
Example of overriding the magic `bool` behavior
|
|
|
|
```console
|
|
$ custom-bool --help
|
|
clap [..]
|
|
A simple to use, efficient, and full-featured Command Line Argument Parser
|
|
|
|
USAGE:
|
|
custom-bool[EXE] [OPTIONS] --foo <FOO> <BOOM>
|
|
|
|
ARGS:
|
|
<BOOM>
|
|
|
|
OPTIONS:
|
|
--bar <BAR> [default: false]
|
|
--foo <FOO>
|
|
-h, --help Print help information
|
|
-V, --version Print version information
|
|
|
|
$ custom-bool
|
|
? failed
|
|
error: The following required arguments were not provided:
|
|
--foo <FOO>
|
|
<BOOM>
|
|
|
|
USAGE:
|
|
custom-bool[EXE] [OPTIONS] --foo <FOO> <BOOM>
|
|
|
|
For more information try --help
|
|
|
|
$ custom-bool --foo true false
|
|
[examples/derive_ref/custom-bool.rs:31] opt = Opt {
|
|
foo: true,
|
|
bar: false,
|
|
boom: false,
|
|
}
|
|
|
|
$ custom-bool --foo true --bar true false
|
|
[examples/derive_ref/custom-bool.rs:31] opt = Opt {
|
|
foo: true,
|
|
bar: true,
|
|
boom: false,
|
|
}
|
|
|
|
```
|