mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 06:42:33 +00:00
bfa02fd418
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"
40 lines
907 B
Markdown
40 lines
907 B
Markdown
This example shows how to create an application with several arguments using usage strings
|
|
|
|
Let's first check out the help:
|
|
```bash
|
|
$ 01a_quick_example --help
|
|
MyApp 1.0
|
|
|
|
Kevin K. <kbknapp@gmail.com>
|
|
|
|
Does awesome things
|
|
|
|
USAGE:
|
|
01a_quick_example[EXE] [OPTIONS] [output] [SUBCOMMAND]
|
|
|
|
ARGS:
|
|
<output> Sets an optional output file
|
|
|
|
OPTIONS:
|
|
-c, --config <FILE> Sets a custom config file
|
|
-d, --debug Turn debugging information on
|
|
-h, --help Print help information
|
|
-V, --version Print version information
|
|
|
|
SUBCOMMANDS:
|
|
help Print this message or the help of the given subcommand(s)
|
|
test does testing things
|
|
```
|
|
|
|
By default, the program does nothing:
|
|
```bash
|
|
$ 01a_quick_example
|
|
Debug mode is off
|
|
```
|
|
|
|
But you can mix and match the various features
|
|
```bash
|
|
$ 01a_quick_example -dd test
|
|
Debug mode is on
|
|
Not printing testing lists...
|
|
```
|