diff options
Diffstat (limited to 'third_party/rust/clap/examples/derive_ref/custom-bool.md')
-rw-r--r-- | third_party/rust/clap/examples/derive_ref/custom-bool.md | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/third_party/rust/clap/examples/derive_ref/custom-bool.md b/third_party/rust/clap/examples/derive_ref/custom-bool.md new file mode 100644 index 0000000000..2769f20e8f --- /dev/null +++ b/third_party/rust/clap/examples/derive_ref/custom-bool.md @@ -0,0 +1,47 @@ +*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, +} + +``` |