clap/examples/03_args.md
Ed Page bfa02fd418 test: More thoroughly test examples
This ports our example testing over to [trycmd](https://docs.rs/) so
we can:
- More thoroughly test our examples
- Provide always-up-to-date example usage

The old way of testing automatically picked up examples.  This new way
requires we have a `.md` file that uses the example in some way.

Notes:
- Moved overall example description to the `.md` file
- I added cross-linking between related examples
- `14_groups` had a redundant paragraph (twice talked about "one and
  only one"
2021-11-23 13:13:41 -06:00

1 KiB

Args describe a possible valid argument which may be supplied by the user at runtime. There are three different types of arguments (flags, options, and positional) as well as a fourth special type of argument, called Subcommands (which will be discussed separately).

Help and Version

clap automatically generates a help and version flag for you, unless you specify your own. By default help uses "-h" and "--help", and version uses "-V" and "--version". You can safely override "-V" and "-h" to your own arguments, and "--help" and "--version" will still be automatically generated for you.

$ 03_args --help
MyApp 

USAGE:
    03_args[EXE] [OPTIONS] <input> [output]

ARGS:
    <input>     the input file to use
    <output>    Supply an output file to use

OPTIONS:
    -c, --config <config>    sets the config file to use
    -d                       turn on debugging information
    -h, --help               Print help information
    -i, --int <IFACE>        Set an interface to use
        --license            display the license file