2022-07-19 13:29:31 -05:00
|
|
|
```console
|
|
|
|
$ 03_04_subcommands help
|
|
|
|
A simple to use, efficient, and full-featured Command Line Argument Parser
|
|
|
|
|
2022-08-26 09:40:23 -05:00
|
|
|
Usage:
|
2022-08-30 21:38:37 -05:00
|
|
|
03_04_subcommands[EXE] <COMMAND>
|
2022-07-19 13:29:31 -05:00
|
|
|
|
2022-08-30 21:38:37 -05:00
|
|
|
Commands:
|
2022-07-19 13:29:31 -05:00
|
|
|
add Adds files to myapp
|
|
|
|
help Print this message or the help of the given subcommand(s)
|
|
|
|
|
2022-08-26 10:59:27 -05:00
|
|
|
Options:
|
|
|
|
-h, --help Print help information
|
|
|
|
-V, --version Print version information
|
|
|
|
|
2022-07-19 13:29:31 -05:00
|
|
|
$ 03_04_subcommands help add
|
|
|
|
Adds files to myapp
|
|
|
|
|
2022-08-26 09:40:23 -05:00
|
|
|
Usage:
|
2022-07-19 13:29:31 -05:00
|
|
|
03_04_subcommands[EXE] add [NAME]
|
|
|
|
|
2022-08-26 09:40:23 -05:00
|
|
|
Arguments:
|
2022-08-29 15:09:06 -05:00
|
|
|
[NAME]
|
2022-07-19 13:29:31 -05:00
|
|
|
|
2022-08-26 09:40:23 -05:00
|
|
|
Options:
|
2022-07-19 13:29:31 -05:00
|
|
|
-h, --help Print help information
|
|
|
|
-V, --version Print version information
|
|
|
|
|
|
|
|
$ 03_04_subcommands add bob
|
|
|
|
'myapp add' was used, name is: Some("bob")
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Because we set [`Command::arg_required_else_help`][crate::Command::arg_required_else_help]:
|
|
|
|
```console
|
|
|
|
$ 03_04_subcommands
|
|
|
|
? failed
|
|
|
|
A simple to use, efficient, and full-featured Command Line Argument Parser
|
|
|
|
|
2022-08-26 09:40:23 -05:00
|
|
|
Usage:
|
2022-08-30 21:38:37 -05:00
|
|
|
03_04_subcommands[EXE] <COMMAND>
|
2022-07-19 13:29:31 -05:00
|
|
|
|
2022-08-30 21:38:37 -05:00
|
|
|
Commands:
|
2022-07-19 13:29:31 -05:00
|
|
|
add Adds files to myapp
|
|
|
|
help Print this message or the help of the given subcommand(s)
|
|
|
|
|
2022-08-26 10:59:27 -05:00
|
|
|
Options:
|
|
|
|
-h, --help Print help information
|
|
|
|
-V, --version Print version information
|
|
|
|
|
2022-07-19 13:29:31 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
Because we set [`Command::propagate_version`][crate::Command::propagate_version]:
|
|
|
|
```console
|
|
|
|
$ 03_04_subcommands --version
|
|
|
|
clap [..]
|
|
|
|
|
|
|
|
$ 03_04_subcommands add --version
|
2022-07-22 11:40:30 -05:00
|
|
|
clap-add [..]
|
2022-07-19 13:29:31 -05:00
|
|
|
|
|
|
|
```
|