clap/examples/derive_ref/custom-bool.md
Ed Page c90a4eabae fix(help): Make output more dense
In looking at other help output, I noticed that they use two spaces, in
place of clap's 4, and it doesn't suffer from legibility.  If it
doesn't make the output worse, let's go ahead and make it as dense so we
fit more content on the screen.

This is a part of #4132
2022-09-07 17:13:55 -05:00

948 B

Jump to source

Example of overriding the magic bool behavior

$ custom-bool --help
A simple to use, efficient, and full-featured Command Line Argument Parser

Usage: custom-bool[EXE] [OPTIONS] --foo <FOO> <BOOM>

Arguments:
  <BOOM>  [possible values: true, false]

Options:
      --foo <FOO>  [possible values: true, false]
      --bar <BAR>  [default: false]
  -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] --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,
}