Merge pull request #4188 from epage/usage

fix(help): Collapse usage to one line
This commit is contained in:
Ed Page 2022-09-07 11:19:42 -05:00 committed by GitHub
commit a228df39b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 343 additions and 647 deletions

View file

@ -6,8 +6,7 @@ mimicking cargo's interface.
The help looks like: The help looks like:
```console ```console
$ cargo-example-derive --help $ cargo-example-derive --help
Usage: Usage: cargo <COMMAND>
cargo <COMMAND>
Commands: Commands:
example-derive A simple to use, efficient, and full-featured Command Line Argument Parser example-derive A simple to use, efficient, and full-featured Command Line Argument Parser
@ -19,8 +18,7 @@ Options:
$ cargo-example-derive example-derive --help $ cargo-example-derive example-derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: cargo example-derive [OPTIONS]
cargo example-derive [OPTIONS]
Options: Options:
--manifest-path <MANIFEST_PATH> --manifest-path <MANIFEST_PATH>

View file

@ -6,8 +6,7 @@ mimicking cargo's interface.
The help looks like: The help looks like:
```console ```console
$ cargo-example --help $ cargo-example --help
Usage: Usage: cargo <COMMAND>
cargo <COMMAND>
Commands: Commands:
example A simple to use, efficient, and full-featured Command Line Argument Parser example A simple to use, efficient, and full-featured Command Line Argument Parser
@ -19,8 +18,7 @@ Options:
$ cargo-example example --help $ cargo-example example --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: cargo example [OPTIONS]
cargo example [OPTIONS]
Options: Options:
--manifest-path <PATH> --manifest-path <PATH>

View file

@ -2,8 +2,7 @@
$ demo --help $ demo --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: demo[EXE] [OPTIONS] --name <NAME>
demo[EXE] [OPTIONS] --name <NAME>
Options: Options:
-n, --name <NAME> Name of the person to greet -n, --name <NAME> Name of the person to greet

View file

@ -6,8 +6,7 @@ Example of overriding the magic `bool` behavior
$ custom-bool --help $ custom-bool --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: custom-bool[EXE] [OPTIONS] --foo <FOO> <BOOM>
custom-bool[EXE] [OPTIONS] --foo <FOO> <BOOM>
Arguments: Arguments:
<BOOM> [possible values: true, false] <BOOM> [possible values: true, false]
@ -24,8 +23,7 @@ error: The following required arguments were not provided:
--foo <FOO> --foo <FOO>
<BOOM> <BOOM>
Usage: Usage: custom-bool[EXE] --foo <FOO> <BOOM>
custom-bool[EXE] --foo <FOO> <BOOM>
For more information try --help For more information try --help

View file

@ -39,8 +39,7 @@ error: Found argument '--unknown' which wasn't expected, or isn't valid in this
If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown`
Usage: Usage: interop_augment_args[EXE] [OPTIONS]
interop_augment_args[EXE] [OPTIONS]
For more information try --help For more information try --help
@ -77,8 +76,7 @@ error: Found argument '--unknown' which wasn't expected, or isn't valid in this
If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown`
Usage: Usage: interop_augment_subcommands[EXE] derived [OPTIONS]
interop_augment_subcommands[EXE] derived [OPTIONS]
For more information try --help For more information try --help
@ -89,8 +87,7 @@ $ interop_augment_subcommands unknown
? failed ? failed
error: Found argument 'unknown' which wasn't expected, or isn't valid in this context error: Found argument 'unknown' which wasn't expected, or isn't valid in this context
Usage: Usage: interop_augment_subcommands[EXE] [COMMAND]
interop_augment_subcommands[EXE] [COMMAND]
For more information try --help For more information try --help
@ -101,8 +98,7 @@ For more information try --help
```console ```console
$ interop_hand_subcommand $ interop_hand_subcommand
? failed ? failed
Usage: Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
Commands: Commands:
add add
@ -152,8 +148,7 @@ error: Found argument '--unknown' which wasn't expected, or isn't valid in this
If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown`
Usage: Usage: interop_hand_subcommand[EXE] add [NAME]...
interop_hand_subcommand[EXE] add [NAME]...
For more information try --help For more information try --help
@ -196,8 +191,7 @@ $ interop_hand_subcommand unknown
? failed ? failed
error: Found argument 'unknown' which wasn't expected, or isn't valid in this context error: Found argument 'unknown' which wasn't expected, or isn't valid in this context
Usage: Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
For more information try --help For more information try --help
@ -253,8 +247,7 @@ error: Found argument '--unknown' which wasn't expected, or isn't valid in this
If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown`
Usage: Usage: interop_flatten_hand_args[EXE] [OPTIONS]
interop_flatten_hand_args[EXE] [OPTIONS]
For more information try --help For more information try --help

View file

@ -7,8 +7,7 @@ Let's see what this looks like in the help:
$ escaped-positional-derive --help $ escaped-positional-derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
Arguments: Arguments:
[SLOP]... [SLOP]...
@ -36,8 +35,7 @@ $ escaped-positional-derive foo bar
? failed ? failed
error: Found argument 'foo' which wasn't expected, or isn't valid in this context error: Found argument 'foo' which wasn't expected, or isn't valid in this context
Usage: Usage: escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
For more information try --help For more information try --help

View file

@ -7,8 +7,7 @@ Let's see what this looks like in the help:
$ escaped-positional --help $ escaped-positional --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: escaped-positional[EXE] [OPTIONS] [-- <SLOP>...]
escaped-positional[EXE] [OPTIONS] [-- <SLOP>...]
Arguments: Arguments:
[SLOP]... [SLOP]...
@ -36,8 +35,7 @@ $ escaped-positional foo bar
? failed ? failed
error: Found argument 'foo' which wasn't expected, or isn't valid in this context error: Found argument 'foo' which wasn't expected, or isn't valid in this context
Usage: Usage: escaped-positional[EXE] [OPTIONS] [-- <SLOP>...]
escaped-positional[EXE] [OPTIONS] [-- <SLOP>...]
For more information try --help For more information try --help

View file

@ -4,8 +4,7 @@
$ find --help $ find --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: find[EXE] [OPTIONS] --name <NAME>
find[EXE] [OPTIONS] --name <NAME>
Options: Options:
-h, --help Print help information -h, --help Print help information

View file

@ -8,8 +8,7 @@ $ git-derive
? failed ? failed
A fictional versioning CLI A fictional versioning CLI
Usage: Usage: git-derive[EXE] <COMMAND>
git-derive[EXE] <COMMAND>
Commands: Commands:
clone Clones repos clone Clones repos
@ -24,8 +23,7 @@ Options:
$ git-derive help $ git-derive help
A fictional versioning CLI A fictional versioning CLI
Usage: Usage: git-derive[EXE] <COMMAND>
git-derive[EXE] <COMMAND>
Commands: Commands:
clone Clones repos clone Clones repos
@ -40,8 +38,7 @@ Options:
$ git-derive help add $ git-derive help add
adds things adds things
Usage: Usage: git-derive[EXE] add <PATH>...
git-derive[EXE] add <PATH>...
Arguments: Arguments:
<PATH>... Stuff to add <PATH>... Stuff to add
@ -57,8 +54,7 @@ $ git-derive add
? failed ? failed
adds things adds things
Usage: Usage: git-derive[EXE] add <PATH>...
git-derive[EXE] add <PATH>...
Arguments: Arguments:
<PATH>... Stuff to add <PATH>... Stuff to add
@ -74,9 +70,8 @@ Adding ["Cargo.toml", "Cargo.lock"]
Default subcommand: Default subcommand:
```console ```console
$ git-derive stash -h $ git-derive stash -h
Usage: Usage: git-derive[EXE] stash [OPTIONS]
git-derive[EXE] stash [OPTIONS] git-derive[EXE] stash <COMMAND>
git-derive[EXE] stash <COMMAND>
Commands: Commands:
push push
@ -89,16 +84,14 @@ Options:
-h, --help Print help information -h, --help Print help information
$ git-derive stash push -h $ git-derive stash push -h
Usage: Usage: git-derive[EXE] stash push [OPTIONS]
git-derive[EXE] stash push [OPTIONS]
Options: Options:
-m, --message <MESSAGE> -m, --message <MESSAGE>
-h, --help Print help information -h, --help Print help information
$ git-derive stash pop -h $ git-derive stash pop -h
Usage: Usage: git-derive[EXE] stash pop [STASH]
git-derive[EXE] stash pop [STASH]
Arguments: Arguments:
[STASH] [STASH]

View file

@ -6,8 +6,7 @@ $ git
? failed ? failed
A fictional versioning CLI A fictional versioning CLI
Usage: Usage: git[EXE] <COMMAND>
git[EXE] <COMMAND>
Commands: Commands:
clone Clones repos clone Clones repos
@ -22,8 +21,7 @@ Options:
$ git help $ git help
A fictional versioning CLI A fictional versioning CLI
Usage: Usage: git[EXE] <COMMAND>
git[EXE] <COMMAND>
Commands: Commands:
clone Clones repos clone Clones repos
@ -38,8 +36,7 @@ Options:
$ git help add $ git help add
adds things adds things
Usage: Usage: git[EXE] add <PATH>...
git[EXE] add <PATH>...
Arguments: Arguments:
<PATH>... Stuff to add <PATH>... Stuff to add
@ -55,8 +52,7 @@ $ git add
? failed ? failed
adds things adds things
Usage: Usage: git[EXE] add <PATH>...
git[EXE] add <PATH>...
Arguments: Arguments:
<PATH>... Stuff to add <PATH>... Stuff to add
@ -72,9 +68,8 @@ Adding ["Cargo.toml", "Cargo.lock"]
Default subcommand: Default subcommand:
```console ```console
$ git stash -h $ git stash -h
Usage: Usage: git[EXE] stash [OPTIONS]
git[EXE] stash [OPTIONS] git[EXE] stash <COMMAND>
git[EXE] stash <COMMAND>
Commands: Commands:
push push
@ -87,16 +82,14 @@ Options:
-h, --help Print help information -h, --help Print help information
$ git stash push -h $ git stash push -h
Usage: Usage: git[EXE] stash push [OPTIONS]
git[EXE] stash push [OPTIONS]
Options: Options:
-m, --message <MESSAGE> -m, --message <MESSAGE>
-h, --help Print help information -h, --help Print help information
$ git stash pop -h $ git stash pop -h
Usage: Usage: git[EXE] stash pop [STASH]
git[EXE] stash pop [STASH]
Arguments: Arguments:
[STASH] [STASH]

View file

@ -25,8 +25,7 @@ Though users must pass something:
```console ```console
$ busybox $ busybox
? failed ? failed
Usage: Usage: busybox [OPTIONS] [APPLET]
busybox [OPTIONS] [APPLET]
APPLETS: APPLETS:
true does nothing successfully true does nothing successfully

View file

@ -37,8 +37,7 @@ In the help, this looks like:
$ pacman -h $ pacman -h
package manager utility package manager utility
Usage: Usage: pacman[EXE] <COMMAND>
pacman[EXE] <COMMAND>
Commands: Commands:
query -Q --query Query the package database. query -Q --query Query the package database.
@ -52,8 +51,7 @@ Options:
$ pacman -S -h $ pacman -S -h
Synchronize packages. Synchronize packages.
Usage: Usage: pacman[EXE] {sync|--sync|-S} [OPTIONS] [package]...
pacman[EXE] {sync|--sync|-S} [OPTIONS] [package]...
Arguments: Arguments:
[package]... packages [package]... packages
@ -71,8 +69,7 @@ $ pacman -S -s foo -i bar
? failed ? failed
error: The argument '--search <search>...' cannot be used with '--info' error: The argument '--search <search>...' cannot be used with '--info'
Usage: Usage: pacman[EXE] {sync|--sync|-S} --search <search>... <package>...
pacman[EXE] {sync|--sync|-S} --search <search>... <package>...
For more information try --help For more information try --help

View file

@ -2,8 +2,7 @@
$ 01_quick --help $ 01_quick --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 01_quick[EXE] [OPTIONS] [name] [COMMAND]
01_quick[EXE] [OPTIONS] [name] [COMMAND]
Commands: Commands:
test does testing things test does testing things

View file

@ -2,8 +2,7 @@
$ 02_app_settings --help $ 02_app_settings --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 02_app_settings[EXE] --two <VALUE> --one <VALUE>
02_app_settings[EXE] --two <VALUE> --one <VALUE>
Options: Options:
--two <VALUE> --two <VALUE>

View file

@ -2,8 +2,7 @@
$ 02_apps --help $ 02_apps --help
Does awesome things Does awesome things
Usage: Usage: 02_apps[EXE] --two <VALUE> --one <VALUE>
02_apps[EXE] --two <VALUE> --one <VALUE>
Options: Options:
--two <VALUE> --two <VALUE>

View file

@ -2,8 +2,7 @@
$ 02_crate --help $ 02_crate --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 02_crate[EXE] --two <VALUE> --one <VALUE>
02_crate[EXE] --two <VALUE> --one <VALUE>
Options: Options:
--two <VALUE> --two <VALUE>

View file

@ -2,8 +2,7 @@
$ 03_01_flag_bool --help $ 03_01_flag_bool --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_01_flag_bool[EXE] [OPTIONS]
03_01_flag_bool[EXE] [OPTIONS]
Options: Options:
-v, --verbose -v, --verbose

View file

@ -2,8 +2,7 @@
$ 03_01_flag_count --help $ 03_01_flag_count --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_01_flag_count[EXE] [OPTIONS]
03_01_flag_count[EXE] [OPTIONS]
Options: Options:
-v, --verbose... -v, --verbose...

View file

@ -2,8 +2,7 @@
$ 03_02_option --help $ 03_02_option --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_02_option[EXE] [OPTIONS]
03_02_option[EXE] [OPTIONS]
Options: Options:
-n, --name <name> -n, --name <name>

View file

@ -2,8 +2,7 @@
$ 03_02_option_mult --help $ 03_02_option_mult --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_02_option_mult[EXE] [OPTIONS]
03_02_option_mult[EXE] [OPTIONS]
Options: Options:
-n, --name <name> -n, --name <name>

View file

@ -2,8 +2,7 @@
$ 03_03_positional --help $ 03_03_positional --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_03_positional[EXE] [name]
03_03_positional[EXE] [name]
Arguments: Arguments:
[name] [name]

View file

@ -2,8 +2,7 @@
$ 03_03_positional_mult --help $ 03_03_positional_mult --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_03_positional_mult[EXE] [name]...
03_03_positional_mult[EXE] [name]...
Arguments: Arguments:
[name]... [name]...

View file

@ -2,8 +2,7 @@
$ 03_04_subcommands help $ 03_04_subcommands help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_04_subcommands[EXE] <COMMAND>
03_04_subcommands[EXE] <COMMAND>
Commands: Commands:
add Adds files to myapp add Adds files to myapp
@ -16,8 +15,7 @@ Options:
$ 03_04_subcommands help add $ 03_04_subcommands help add
Adds files to myapp Adds files to myapp
Usage: Usage: 03_04_subcommands[EXE] add [NAME]
03_04_subcommands[EXE] add [NAME]
Arguments: Arguments:
[NAME] [NAME]
@ -37,8 +35,7 @@ $ 03_04_subcommands
? failed ? failed
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_04_subcommands[EXE] <COMMAND>
03_04_subcommands[EXE] <COMMAND>
Commands: Commands:
add Adds files to myapp add Adds files to myapp

View file

@ -2,8 +2,7 @@
$ 03_05_default_values --help $ 03_05_default_values --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_05_default_values[EXE] [NAME]
03_05_default_values[EXE] [NAME]
Arguments: Arguments:
[NAME] [default: alice] [NAME] [default: alice]

View file

@ -2,8 +2,7 @@
$ 04_01_enum --help $ 04_01_enum --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_01_enum[EXE] <MODE>
04_01_enum[EXE] <MODE>
Arguments: Arguments:
<MODE> What mode to run the program in [possible values: fast, slow] <MODE> What mode to run the program in [possible values: fast, slow]

View file

@ -2,8 +2,7 @@
$ 04_01_possible --help $ 04_01_possible --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_01_possible[EXE] <MODE>
04_01_possible[EXE] <MODE>
Arguments: Arguments:
<MODE> What mode to run the program in [possible values: fast, slow] <MODE> What mode to run the program in [possible values: fast, slow]

View file

@ -2,8 +2,7 @@
$ 04_02_parse --help $ 04_02_parse --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_02_parse[EXE] <PORT>
04_02_parse[EXE] <PORT>
Arguments: Arguments:
<PORT> Network port to use <PORT> Network port to use

View file

@ -2,8 +2,7 @@
$ 04_02_validate --help $ 04_02_validate --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_02_validate[EXE] <PORT>
04_02_validate[EXE] <PORT>
Arguments: Arguments:
<PORT> Network port to use <PORT> Network port to use

View file

@ -2,8 +2,7 @@
$ 04_03_relations --help $ 04_03_relations --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_03_relations[EXE] [OPTIONS] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
04_03_relations[EXE] [OPTIONS] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
Arguments: Arguments:
[INPUT_FILE] some regular input [INPUT_FILE] some regular input
@ -23,8 +22,7 @@ $ 04_03_relations
error: The following required arguments were not provided: error: The following required arguments were not provided:
<--set-ver <VER>|--major|--minor|--patch> <--set-ver <VER>|--major|--minor|--patch>
Usage: Usage: 04_03_relations[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
04_03_relations[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
For more information try --help For more information try --help
@ -35,8 +33,7 @@ $ 04_03_relations --major --minor
? failed ? failed
error: The argument '--major' cannot be used with '--minor' error: The argument '--major' cannot be used with '--minor'
Usage: Usage: 04_03_relations[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
04_03_relations[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
For more information try --help For more information try --help
@ -45,8 +42,7 @@ $ 04_03_relations --major -c config.toml
error: The following required arguments were not provided: error: The following required arguments were not provided:
<INPUT_FILE|--spec-in <SPEC_IN>> <INPUT_FILE|--spec-in <SPEC_IN>>
Usage: Usage: 04_03_relations[EXE] -c <CONFIG> <--set-ver <VER>|--major|--minor|--patch> <INPUT_FILE|--spec-in <SPEC_IN>>
04_03_relations[EXE] -c <CONFIG> <--set-ver <VER>|--major|--minor|--patch> <INPUT_FILE|--spec-in <SPEC_IN>>
For more information try --help For more information try --help

View file

@ -2,8 +2,7 @@
$ 04_04_custom --help $ 04_04_custom --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
Arguments: Arguments:
[INPUT_FILE] some regular input [INPUT_FILE] some regular input
@ -22,8 +21,7 @@ $ 04_04_custom
? failed ? failed
error: Can only modify one version field error: Can only modify one version field
Usage: Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
For more information try --help For more information try --help
@ -34,8 +32,7 @@ $ 04_04_custom --major --minor
? failed ? failed
error: Can only modify one version field error: Can only modify one version field
Usage: Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
For more information try --help For more information try --help
@ -44,8 +41,7 @@ $ 04_04_custom --major -c config.toml
Version: 2.2.3 Version: 2.2.3
error: INPUT_FILE or --spec-in is required when using --config error: INPUT_FILE or --spec-in is required when using --config
Usage: Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
For more information try --help For more information try --help

View file

@ -2,8 +2,7 @@
$ 01_quick_derive --help $ 01_quick_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 01_quick_derive[EXE] [OPTIONS] [NAME] [COMMAND]
01_quick_derive[EXE] [OPTIONS] [NAME] [COMMAND]
Commands: Commands:
test does testing things test does testing things

View file

@ -2,8 +2,7 @@
$ 02_app_settings_derive --help $ 02_app_settings_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 02_app_settings_derive[EXE] --two <TWO> --one <ONE>
02_app_settings_derive[EXE] --two <TWO> --one <ONE>
Options: Options:
--two <TWO> --two <TWO>

View file

@ -2,8 +2,7 @@
$ 02_apps_derive --help $ 02_apps_derive --help
Does awesome things Does awesome things
Usage: Usage: 02_apps_derive[EXE] --two <TWO> --one <ONE>
02_apps_derive[EXE] --two <TWO> --one <ONE>
Options: Options:
--two <TWO> --two <TWO>

View file

@ -2,8 +2,7 @@
$ 02_crate_derive --help $ 02_crate_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 02_crate_derive[EXE] --two <TWO> --one <ONE>
02_crate_derive[EXE] --two <TWO> --one <ONE>
Options: Options:
--two <TWO> --two <TWO>

View file

@ -2,8 +2,7 @@
$ 03_01_flag_bool_derive --help $ 03_01_flag_bool_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_01_flag_bool_derive[EXE] [OPTIONS]
03_01_flag_bool_derive[EXE] [OPTIONS]
Options: Options:
-v, --verbose -v, --verbose

View file

@ -2,8 +2,7 @@
$ 03_01_flag_count_derive --help $ 03_01_flag_count_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_01_flag_count_derive[EXE] [OPTIONS]
03_01_flag_count_derive[EXE] [OPTIONS]
Options: Options:
-v, --verbose... -v, --verbose...

View file

@ -2,8 +2,7 @@
$ 03_02_option_derive --help $ 03_02_option_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_02_option_derive[EXE] [OPTIONS]
03_02_option_derive[EXE] [OPTIONS]
Options: Options:
-n, --name <NAME> -n, --name <NAME>

View file

@ -2,8 +2,7 @@
$ 03_02_option_mult_derive --help $ 03_02_option_mult_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_02_option_mult_derive[EXE] [OPTIONS]
03_02_option_mult_derive[EXE] [OPTIONS]
Options: Options:
-n, --name <NAME> -n, --name <NAME>

View file

@ -2,8 +2,7 @@
$ 03_03_positional_derive --help $ 03_03_positional_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_03_positional_derive[EXE] [NAME]
03_03_positional_derive[EXE] [NAME]
Arguments: Arguments:
[NAME] [NAME]

View file

@ -2,8 +2,7 @@
$ 03_03_positional_mult_derive --help $ 03_03_positional_mult_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_03_positional_mult_derive[EXE] [NAME]...
03_03_positional_mult_derive[EXE] [NAME]...
Arguments: Arguments:
[NAME]... [NAME]...

View file

@ -2,8 +2,7 @@
$ 03_04_subcommands_derive help $ 03_04_subcommands_derive help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_04_subcommands_derive[EXE] <COMMAND>
03_04_subcommands_derive[EXE] <COMMAND>
Commands: Commands:
add Adds files to myapp add Adds files to myapp
@ -16,8 +15,7 @@ Options:
$ 03_04_subcommands_derive help add $ 03_04_subcommands_derive help add
Adds files to myapp Adds files to myapp
Usage: Usage: 03_04_subcommands_derive[EXE] add [NAME]
03_04_subcommands_derive[EXE] add [NAME]
Arguments: Arguments:
[NAME] [NAME]
@ -37,8 +35,7 @@ $ 03_04_subcommands_derive
? failed ? failed
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_04_subcommands_derive[EXE] <COMMAND>
03_04_subcommands_derive[EXE] <COMMAND>
Commands: Commands:
add Adds files to myapp add Adds files to myapp

View file

@ -2,8 +2,7 @@
$ 03_05_default_values_derive --help $ 03_05_default_values_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 03_05_default_values_derive[EXE] [NAME]
03_05_default_values_derive[EXE] [NAME]
Arguments: Arguments:
[NAME] [default: alice] [NAME] [default: alice]

View file

@ -2,8 +2,7 @@
$ 04_01_enum_derive --help $ 04_01_enum_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_01_enum_derive[EXE] <MODE>
04_01_enum_derive[EXE] <MODE>
Arguments: Arguments:
<MODE> What mode to run the program in [possible values: fast, slow] <MODE> What mode to run the program in [possible values: fast, slow]

View file

@ -2,8 +2,7 @@
$ 04_02_parse_derive --help $ 04_02_parse_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_02_parse_derive[EXE] <PORT>
04_02_parse_derive[EXE] <PORT>
Arguments: Arguments:
<PORT> Network port to use <PORT> Network port to use

View file

@ -2,8 +2,7 @@
$ 04_02_validate_derive --help $ 04_02_validate_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_02_validate_derive[EXE] <PORT>
04_02_validate_derive[EXE] <PORT>
Arguments: Arguments:
<PORT> Network port to use <PORT> Network port to use

View file

@ -2,8 +2,7 @@
$ 04_03_relations_derive --help $ 04_03_relations_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_03_relations_derive[EXE] [OPTIONS] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
04_03_relations_derive[EXE] [OPTIONS] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
Arguments: Arguments:
[INPUT_FILE] some regular input [INPUT_FILE] some regular input
@ -23,8 +22,7 @@ $ 04_03_relations_derive
error: The following required arguments were not provided: error: The following required arguments were not provided:
<--set-ver <VER>|--major|--minor|--patch> <--set-ver <VER>|--major|--minor|--patch>
Usage: Usage: 04_03_relations_derive[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
04_03_relations_derive[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
For more information try --help For more information try --help
@ -35,8 +33,7 @@ $ 04_03_relations_derive --major --minor
? failed ? failed
error: The argument '--major' cannot be used with '--minor' error: The argument '--major' cannot be used with '--minor'
Usage: Usage: 04_03_relations_derive[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
04_03_relations_derive[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
For more information try --help For more information try --help
@ -45,8 +42,7 @@ $ 04_03_relations_derive --major -c config.toml
error: The following required arguments were not provided: error: The following required arguments were not provided:
<INPUT_FILE|--spec-in <SPEC_IN>> <INPUT_FILE|--spec-in <SPEC_IN>>
Usage: Usage: 04_03_relations_derive[EXE] -c <CONFIG> <--set-ver <VER>|--major|--minor|--patch> <INPUT_FILE|--spec-in <SPEC_IN>>
04_03_relations_derive[EXE] -c <CONFIG> <--set-ver <VER>|--major|--minor|--patch> <INPUT_FILE|--spec-in <SPEC_IN>>
For more information try --help For more information try --help

View file

@ -2,8 +2,7 @@
$ 04_04_custom_derive --help $ 04_04_custom_derive --help
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: 04_04_custom_derive[EXE] [OPTIONS] [INPUT_FILE]
04_04_custom_derive[EXE] [OPTIONS] [INPUT_FILE]
Arguments: Arguments:
[INPUT_FILE] some regular input [INPUT_FILE] some regular input
@ -22,8 +21,7 @@ $ 04_04_custom_derive
? failed ? failed
error: Can only modify one version field error: Can only modify one version field
Usage: Usage: clap [OPTIONS] [INPUT_FILE]
clap [OPTIONS] [INPUT_FILE]
For more information try --help For more information try --help
@ -34,8 +32,7 @@ $ 04_04_custom_derive --major --minor
? failed ? failed
error: Can only modify one version field error: Can only modify one version field
Usage: Usage: clap [OPTIONS] [INPUT_FILE]
clap [OPTIONS] [INPUT_FILE]
For more information try --help For more information try --help
@ -44,8 +41,7 @@ $ 04_04_custom_derive --major -c config.toml
Version: 2.2.3 Version: 2.2.3
error: INPUT_FILE or --spec-in is required when using --config error: INPUT_FILE or --spec-in is required when using --config
Usage: Usage: clap [OPTIONS] [INPUT_FILE]
clap [OPTIONS] [INPUT_FILE]
For more information try --help For more information try --help

View file

@ -3,8 +3,7 @@
Help: Help:
```console ```console
$ typed-derive --help $ typed-derive --help
Usage: Usage: typed-derive[EXE] [OPTIONS]
typed-derive[EXE] [OPTIONS]
Options: Options:
-O <OPTIMIZATION> Implicitly using `std::str::FromStr` -O <OPTIMIZATION> Implicitly using `std::str::FromStr`

View file

@ -1103,8 +1103,7 @@ impl Arg {
/// ```text /// ```text
/// valnames /// valnames
/// ///
/// Usage: /// Usage: valnames [OPTIONS]
/// valnames [OPTIONS]
/// ///
/// Options: /// Options:
/// --config <FILE> Some help text /// --config <FILE> Some help text
@ -1160,8 +1159,7 @@ impl Arg {
/// ```text /// ```text
/// valnames /// valnames
/// ///
/// Usage: /// Usage: valnames [OPTIONS]
/// valnames [OPTIONS]
/// ///
/// Options: /// Options:
/// -h, --help Print help information /// -h, --help Print help information
@ -1971,8 +1969,7 @@ impl Arg {
/// ```notrust /// ```notrust
/// helptest /// helptest
/// ///
/// Usage: /// Usage: helptest [OPTIONS]
/// helptest [OPTIONS]
/// ///
/// Options: /// Options:
/// --config Some help text describing the --config arg /// --config Some help text describing the --config arg
@ -2025,8 +2022,7 @@ impl Arg {
/// ```text /// ```text
/// prog /// prog
/// ///
/// Usage: /// Usage: prog [OPTIONS]
/// prog [OPTIONS]
/// ///
/// Options: /// Options:
/// --config /// --config
@ -2091,8 +2087,7 @@ impl Arg {
/// ```text /// ```text
/// cust-ord /// cust-ord
/// ///
/// Usage: /// Usage: cust-ord [OPTIONS]
/// cust-ord [OPTIONS]
/// ///
/// Options: /// Options:
/// -h, --help Print help information /// -h, --help Print help information
@ -2151,8 +2146,7 @@ impl Arg {
/// ```text /// ```text
/// nlh /// nlh
/// ///
/// Usage: /// Usage: nlh [OPTIONS]
/// nlh [OPTIONS]
/// ///
/// Options: /// Options:
/// -h, --help Print help information /// -h, --help Print help information
@ -2197,8 +2191,7 @@ impl Arg {
/// ```text /// ```text
/// helptest /// helptest
/// ///
/// Usage: /// Usage: helptest [OPTIONS]
/// helptest [OPTIONS]
/// ///
/// Options: /// Options:
/// -h, --help Print help information /// -h, --help Print help information
@ -2371,8 +2364,7 @@ impl Arg {
/// ```text /// ```text
/// helptest /// helptest
/// ///
/// Usage: /// Usage: helptest [OPTIONS]
/// helptest [OPTIONS]
/// ///
/// Options: /// Options:
/// -h, --help Print help information /// -h, --help Print help information
@ -2398,8 +2390,7 @@ impl Arg {
/// ```text /// ```text
/// helptest /// helptest
/// ///
/// Usage: /// Usage: helptest [OPTIONS]
/// helptest [OPTIONS]
/// ///
/// Options: /// Options:
/// --config Some help text describing the --config arg /// --config Some help text describing the --config arg
@ -2444,8 +2435,7 @@ impl Arg {
/// ```text /// ```text
/// helptest /// helptest
/// ///
/// Usage: /// Usage: helptest [OPTIONS]
/// helptest [OPTIONS]
/// ///
/// Options: /// Options:
/// -h, --help Print help information /// -h, --help Print help information
@ -2471,8 +2461,7 @@ impl Arg {
/// ```text /// ```text
/// helptest /// helptest
/// ///
/// Usage: /// Usage: helptest [OPTIONS]
/// helptest [OPTIONS]
/// ///
/// OPTIONS: /// OPTIONS:
/// --config Some help text describing the --config arg /// --config Some help text describing the --config arg

View file

@ -2536,8 +2536,7 @@ impl Command {
/// ```text /// ```text
/// cust-ord /// cust-ord
/// ///
/// Usage: /// Usage: cust-ord [OPTIONS]
/// cust-ord [OPTIONS]
/// ///
/// Commands: /// Commands:
/// beta I should be first! /// beta I should be first!
@ -3004,8 +3003,7 @@ impl Command {
/// ```text /// ```text
/// myprog /// myprog
/// ///
/// Usage: /// Usage: myprog [COMMAND]
/// myprog [COMMAND]
/// ///
/// Commands: /// Commands:
/// help Print this message or the help of the given subcommand(s) /// help Print this message or the help of the given subcommand(s)
@ -3032,16 +3030,15 @@ impl Command {
/// ```text /// ```text
/// myprog /// myprog
/// ///
/// Usage: /// Usage: myprog [THING]
/// myprog [THING]
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ///
/// Commands: /// Commands:
/// help Print this message or the help of the given subcommand(s) /// help Print this message or the help of the given subcommand(s)
/// sub1 /// sub1
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ``` /// ```
#[must_use] #[must_use]
pub fn subcommand_value_name(mut self, value_name: impl Into<Str>) -> Self { pub fn subcommand_value_name(mut self, value_name: impl Into<Str>) -> Self {
@ -3070,16 +3067,15 @@ impl Command {
/// ```text /// ```text
/// myprog /// myprog
/// ///
/// Usage: /// Usage: myprog [COMMAND]
/// myprog [COMMAND]
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ///
/// Commands: /// Commands:
/// help Print this message or the help of the given subcommand(s) /// help Print this message or the help of the given subcommand(s)
/// sub1 /// sub1
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ``` /// ```
/// ///
/// but usage of `subcommand_help_heading` /// but usage of `subcommand_help_heading`
@ -3098,16 +3094,15 @@ impl Command {
/// ```text /// ```text
/// myprog /// myprog
/// ///
/// Usage: /// Usage: myprog [COMMAND]
/// myprog [COMMAND]
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ///
/// Things: /// Things:
/// help Print this message or the help of the given subcommand(s) /// help Print this message or the help of the given subcommand(s)
/// sub1 /// sub1
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ``` /// ```
#[must_use] #[must_use]
pub fn subcommand_help_heading(mut self, heading: impl Into<Str>) -> Self { pub fn subcommand_help_heading(mut self, heading: impl Into<Str>) -> Self {

View file

@ -32,16 +32,14 @@ pub(crate) struct Help<'cmd, 'writer> {
impl<'cmd, 'writer> Help<'cmd, 'writer> { impl<'cmd, 'writer> Help<'cmd, 'writer> {
const DEFAULT_TEMPLATE: &'static str = "\ const DEFAULT_TEMPLATE: &'static str = "\
{before-help}{about-with-newline} {before-help}{about-with-newline}
{usage-heading} {usage-heading} {usage}
{tab}{usage}
{all-args}{after-help}\ {all-args}{after-help}\
"; ";
const DEFAULT_NO_ARGS_TEMPLATE: &'static str = "\ const DEFAULT_NO_ARGS_TEMPLATE: &'static str = "\
{before-help}{about-with-newline} {before-help}{about-with-newline}
{usage-heading} {usage-heading} {usage}{after-help}\
{tab}{usage}{after-help}\
"; ";
/// Create a new `Help` instance. /// Create a new `Help` instance.

View file

@ -1,7 +1,6 @@
// Internal // Internal
use crate::builder::StyledStr; use crate::builder::StyledStr;
use crate::builder::{ArgPredicate, Command}; use crate::builder::{ArgPredicate, Command};
use crate::output::TAB;
use crate::parser::ArgMatcher; use crate::parser::ArgMatcher;
use crate::util::ChildGraph; use crate::util::ChildGraph;
use crate::util::FlatSet; use crate::util::FlatSet;
@ -33,8 +32,7 @@ impl<'cmd> Usage<'cmd> {
debug!("Usage::create_usage_with_title"); debug!("Usage::create_usage_with_title");
let mut styled = StyledStr::new(); let mut styled = StyledStr::new();
styled.header("Usage:"); styled.header("Usage:");
styled.none("\n"); styled.none(" ");
styled.none(TAB);
styled.extend(self.create_usage_no_title(used).into_iter()); styled.extend(self.create_usage_no_title(used).into_iter());
styled styled
} }
@ -80,7 +78,7 @@ impl<'cmd> Usage<'cmd> {
|| self.cmd.is_args_conflicts_with_subcommands_set() || self.cmd.is_args_conflicts_with_subcommands_set()
{ {
styled.none("\n"); styled.none("\n");
styled.none(TAB); styled.none(" ");
if self.cmd.is_args_conflicts_with_subcommands_set() { if self.cmd.is_args_conflicts_with_subcommands_set() {
// Short-circuit full usage creation since no args will be relevant // Short-circuit full usage creation since no args will be relevant
styled.literal(name); styled.literal(name);

View file

@ -5,8 +5,7 @@ use super::utils;
use clap::{arg, error::ErrorKind, Arg, ArgAction, Command}; use clap::{arg, error::ErrorKind, Arg, ArgAction, Command};
static ALLOW_EXT_SC: &str = "\ static ALLOW_EXT_SC: &str = "\
Usage: Usage: clap-test [COMMAND]
clap-test [COMMAND]
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -14,8 +13,7 @@ Options:
"; ";
static DONT_COLLAPSE_ARGS: &str = "\ static DONT_COLLAPSE_ARGS: &str = "\
Usage: Usage: clap-test [arg1] [arg2] [arg3]
clap-test [arg1] [arg2] [arg3]
Arguments: Arguments:
[arg1] some [arg1] some
@ -124,8 +122,7 @@ fn arg_required_else_help_with_default() {
#[test] #[test]
fn arg_required_else_help_error_message() { fn arg_required_else_help_error_message() {
static ARG_REQUIRED_ELSE_HELP: &str = "\ static ARG_REQUIRED_ELSE_HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-i, --info Provides more info -i, --info Provides more info
@ -284,8 +281,7 @@ fn skip_possible_values() {
static SKIP_POS_VALS: &str = "\ static SKIP_POS_VALS: &str = "\
tests stuff tests stuff
Usage: Usage: test [OPTIONS] [arg1]
test [OPTIONS] [arg1]
Arguments: Arguments:
[arg1] some pos arg [arg1] some pos arg
@ -625,8 +621,7 @@ fn dont_collapse_args() {
#[test] #[test]
fn require_eq() { fn require_eq() {
static REQUIRE_EQUALS: &str = "\ static REQUIRE_EQUALS: &str = "\
Usage: Usage: clap-test --opt=<FILE>
clap-test --opt=<FILE>
Options: Options:
-o, --opt=<FILE> some -o, --opt=<FILE> some

View file

@ -193,8 +193,7 @@ fn invisible_arg_aliases_help_output() {
static SC_INVISIBLE_ALIAS_HELP: &str = "\ static SC_INVISIBLE_ALIAS_HELP: &str = "\
Some help Some help
Usage: Usage: ct test [OPTIONS]
ct test [OPTIONS]
Options: Options:
-o, --opt <opt> -o, --opt <opt>
@ -224,8 +223,7 @@ fn visible_arg_aliases_help_output() {
static SC_VISIBLE_ALIAS_HELP: &str = "\ static SC_VISIBLE_ALIAS_HELP: &str = "\
Some help Some help
Usage: Usage: ct test [OPTIONS]
ct test [OPTIONS]
Options: Options:
-o, --opt <opt> [aliases: visible] -o, --opt <opt> [aliases: visible]

View file

@ -160,8 +160,7 @@ fn invisible_short_arg_aliases_help_output() {
static SC_INVISIBLE_ALIAS_HELP: &str = "\ static SC_INVISIBLE_ALIAS_HELP: &str = "\
Some help Some help
Usage: Usage: ct test [OPTIONS]
ct test [OPTIONS]
Options: Options:
-o, --opt <opt> -o, --opt <opt>
@ -191,8 +190,7 @@ fn visible_short_arg_aliases_help_output() {
static SC_VISIBLE_ALIAS_HELP: &str = "\ static SC_VISIBLE_ALIAS_HELP: &str = "\
Some help Some help
Usage: Usage: ct test [OPTIONS]
ct test [OPTIONS]
Options: Options:
-o, --opt <opt> [short aliases: v] -o, --opt <opt> [short aliases: v]

View file

@ -9,8 +9,7 @@ use crate::utils;
static DESCRIPTION_ONLY: &str = "prog 1 static DESCRIPTION_ONLY: &str = "prog 1
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: prog
prog
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -20,8 +19,7 @@ Options:
static AUTHORS_ONLY: &str = "prog 1 static AUTHORS_ONLY: &str = "prog 1
Usage: Usage: prog
prog
Options: Options:
-h, --help Print help information -h, --help Print help information

View file

@ -7,8 +7,7 @@ use crate::utils;
static EVERYTHING: &str = "clap {{version}} static EVERYTHING: &str = "clap {{version}}
A simple to use, efficient, and full-featured Command Line Argument Parser A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: Usage: clap
clap
Options: Options:
-h, --help Print help information -h, --help Print help information

View file

@ -292,8 +292,7 @@ fn get_arg_conflicts_with_group() {
fn conflict_output() { fn conflict_output() {
static CONFLICT_ERR: &str = "error: The argument '--flag...' cannot be used with '-F' static CONFLICT_ERR: &str = "error: The argument '--flag...' cannot be used with '-F'
Usage: Usage: clap-test --flag... --long-option-2 <option2> <positional> <positional2> [positional3]...
clap-test --flag... --long-option-2 <option2> <positional> <positional2> [positional3]...
For more information try --help For more information try --help
"; ";
@ -310,8 +309,7 @@ For more information try --help
fn conflict_output_rev() { fn conflict_output_rev() {
static CONFLICT_ERR_REV: &str = "error: The argument '-F' cannot be used with '--flag...' static CONFLICT_ERR_REV: &str = "error: The argument '-F' cannot be used with '--flag...'
Usage: Usage: clap-test -F --long-option-2 <option2> <positional> <positional2> [positional3]...
clap-test -F --long-option-2 <option2> <positional> <positional2> [positional3]...
For more information try --help For more information try --help
"; ";
@ -328,8 +326,7 @@ For more information try --help
fn conflict_output_with_required() { fn conflict_output_with_required() {
static CONFLICT_ERR: &str = "error: The argument '--flag...' cannot be used with '-F' static CONFLICT_ERR: &str = "error: The argument '--flag...' cannot be used with '-F'
Usage: Usage: clap-test --flag... --long-option-2 <option2> <positional> <positional2> [positional3]...
clap-test --flag... --long-option-2 <option2> <positional> <positional2> [positional3]...
For more information try --help For more information try --help
"; ";
@ -346,8 +343,7 @@ For more information try --help
fn conflict_output_rev_with_required() { fn conflict_output_rev_with_required() {
static CONFLICT_ERR_REV: &str = "error: The argument '-F' cannot be used with '--flag...' static CONFLICT_ERR_REV: &str = "error: The argument '-F' cannot be used with '--flag...'
Usage: Usage: clap-test -F --long-option-2 <option2> <positional> <positional2> [positional3]...
clap-test -F --long-option-2 <option2> <positional> <positional2> [positional3]...
For more information try --help For more information try --help
"; ";
@ -366,8 +362,7 @@ fn conflict_output_three_conflicting() {
--two --two
--three --three
Usage: Usage: three_conflicting_arguments --one
three_conflicting_arguments --one
For more information try --help For more information try --help
"; ";

View file

@ -731,8 +731,7 @@ fn default_vals_donnot_show_in_smart_usage() {
"error: The following required arguments were not provided: "error: The following required arguments were not provided:
<input> <input>
Usage: Usage: bug <input>
bug <input>
For more information try --help For more information try --help
", ",

View file

@ -7,8 +7,7 @@ use clap::{Arg, ArgAction, Command};
#[test] #[test]
fn no_derive_order() { fn no_derive_order() {
static NO_DERIVE_ORDER: &str = "\ static NO_DERIVE_ORDER: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
--flag_a second flag --flag_a second flag
@ -47,8 +46,7 @@ Options:
#[test] #[test]
fn derive_order() { fn derive_order() {
static UNIFIED_HELP_AND_DERIVE: &str = "\ static UNIFIED_HELP_AND_DERIVE: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
--flag_b first flag --flag_b first flag
@ -84,8 +82,7 @@ Options:
#[test] #[test]
fn derive_order_next_order() { fn derive_order_next_order() {
static HELP: &str = "\ static HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
--flag_b first flag --flag_b first flag
@ -131,8 +128,7 @@ Options:
#[test] #[test]
fn derive_order_no_next_order() { fn derive_order_no_next_order() {
static HELP: &str = "\ static HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
--flag_a first flag --flag_a first flag
@ -177,8 +173,7 @@ Options:
#[test] #[test]
fn derive_order_subcommand_propagate() { fn derive_order_subcommand_propagate() {
static UNIFIED_DERIVE_SC_PROP: &str = "\ static UNIFIED_DERIVE_SC_PROP: &str = "\
Usage: Usage: test sub [OPTIONS]
test sub [OPTIONS]
Options: Options:
--flag_b first flag --flag_b first flag
@ -216,8 +211,7 @@ Options:
#[test] #[test]
fn derive_order_subcommand_propagate_with_explicit_display_order() { fn derive_order_subcommand_propagate_with_explicit_display_order() {
static UNIFIED_DERIVE_SC_PROP_EXPLICIT_ORDER: &str = "\ static UNIFIED_DERIVE_SC_PROP_EXPLICIT_ORDER: &str = "\
Usage: Usage: test sub [OPTIONS]
test sub [OPTIONS]
Options: Options:
--flag_a second flag --flag_a second flag
@ -261,8 +255,7 @@ Options:
#[test] #[test]
fn subcommand_sorted_display_order() { fn subcommand_sorted_display_order() {
static SUBCMD_ALPHA_ORDER: &str = "\ static SUBCMD_ALPHA_ORDER: &str = "\
Usage: Usage: test [COMMAND]
test [COMMAND]
Commands: Commands:
a1 blah a1 a1 blah a1
@ -297,8 +290,7 @@ Options:
#[test] #[test]
fn subcommand_derived_display_order() { fn subcommand_derived_display_order() {
static SUBCMD_DECL_ORDER: &str = "\ static SUBCMD_DECL_ORDER: &str = "\
Usage: Usage: test [COMMAND]
test [COMMAND]
Commands: Commands:
b1 blah b1 b1 blah b1

View file

@ -10,8 +10,7 @@ fn very_large_display_order() {
cmd, cmd,
"test --help", "test --help",
"\ "\
Usage: Usage: test [COMMAND]
test [COMMAND]
Commands: Commands:
help Print this message or the help of the given subcommand(s) help Print this message or the help of the given subcommand(s)

View file

@ -1,8 +1,7 @@
use clap::{error::ErrorKind, Arg, ArgAction, Command}; use clap::{error::ErrorKind, Arg, ArgAction, Command};
static HELP: &str = "\ static HELP: &str = "\
Usage: Usage: prog [OPTIONS]
prog [OPTIONS]
Options: Options:
-a -a
@ -14,8 +13,7 @@ Options:
static ONLY_B_ERROR: &str = "error: The following required arguments were not provided: static ONLY_B_ERROR: &str = "error: The following required arguments were not provided:
-c -c
Usage: Usage: prog -b -c
prog -b -c
For more information try --help For more information try --help
"; ";
@ -23,8 +21,7 @@ For more information try --help
static ONLY_C_ERROR: &str = "error: The following required arguments were not provided: static ONLY_C_ERROR: &str = "error: The following required arguments were not provided:
-b -b
Usage: Usage: prog -c -b
prog -c -b
For more information try --help For more information try --help
"; ";

View file

@ -118,8 +118,7 @@ fn no_empty_values_without_equals_but_requires_equals() {
static NO_EUQALS_ERROR: &str = static NO_EUQALS_ERROR: &str =
"error: Equal sign is needed when assigning values to '--config=<config>'. "error: Equal sign is needed when assigning values to '--config=<config>'.
Usage: Usage: config [OPTIONS]
config [OPTIONS]
For more information try --help For more information try --help
"; ";

View file

@ -25,8 +25,7 @@ fn assert_error<F: clap::error::ErrorFormatter>(
fn app_error() { fn app_error() {
static MESSAGE: &str = "error: Failed for mysterious reasons static MESSAGE: &str = "error: Failed for mysterious reasons
Usage: Usage: test [OPTIONS] --all
test [OPTIONS] --all
For more information try --help For more information try --help
"; ";
@ -89,8 +88,7 @@ fn null_prints_help() {
let err = res.unwrap_err(); let err = res.unwrap_err();
let expected_kind = ErrorKind::DisplayHelp; let expected_kind = ErrorKind::DisplayHelp;
static MESSAGE: &str = "\ static MESSAGE: &str = "\
Usage: Usage: test
test
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -108,8 +106,7 @@ fn raw_prints_help() {
let err = res.unwrap_err(); let err = res.unwrap_err();
let expected_kind = ErrorKind::DisplayHelp; let expected_kind = ErrorKind::DisplayHelp;
static MESSAGE: &str = "\ static MESSAGE: &str = "\
Usage: Usage: test
test
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -140,8 +137,7 @@ fn rich_formats_validation_error() {
static MESSAGE: &str = "\ static MESSAGE: &str = "\
error: Found argument 'unused' which wasn't expected, or isn't valid in this context error: Found argument 'unused' which wasn't expected, or isn't valid in this context
Usage: Usage: test
test
For more information try --help For more information try --help
"; ";
@ -161,8 +157,7 @@ fn raw_formats_validation_error() {
error: Found an argument which wasn't expected or isn't valid in this context error: Found an argument which wasn't expected or isn't valid in this context
Invalid Argument: unused Invalid Argument: unused
Usage: Usage: test
test
"; ";
assert_error(err, expected_kind, MESSAGE, true); assert_error(err, expected_kind, MESSAGE, true);
} }

View file

@ -499,8 +499,7 @@ fn flag_subcommand_long_infer_exact_match() {
static FLAG_SUBCOMMAND_HELP: &str = "\ static FLAG_SUBCOMMAND_HELP: &str = "\
Query the package database. Query the package database.
Usage: Usage: pacman {query|--query|-Q} [OPTIONS]
pacman {query|--query|-Q} [OPTIONS]
Options: Options:
-s, --search <search>... search locally installed packages for matching strings -s, --search <search>... search locally installed packages for matching strings
@ -548,8 +547,7 @@ fn flag_subcommand_long_short_normal_usage_string() {
static FLAG_SUBCOMMAND_NO_SHORT_HELP: &str = "\ static FLAG_SUBCOMMAND_NO_SHORT_HELP: &str = "\
Query the package database. Query the package database.
Usage: Usage: pacman {query|--query} [OPTIONS]
pacman {query|--query} [OPTIONS]
Options: Options:
-s, --search <search>... search locally installed packages for matching strings -s, --search <search>... search locally installed packages for matching strings
@ -601,8 +599,7 @@ fn flag_subcommand_long_normal_usage_string() {
static FLAG_SUBCOMMAND_NO_LONG_HELP: &str = "\ static FLAG_SUBCOMMAND_NO_LONG_HELP: &str = "\
Query the package database. Query the package database.
Usage: Usage: pacman {query|-Q} [OPTIONS]
pacman {query|-Q} [OPTIONS]
Options: Options:
-s, --search <search>... search locally installed packages for matching strings -s, --search <search>... search locally installed packages for matching strings

View file

@ -6,8 +6,7 @@ const USE_FLAG_AS_ARGUMENT: &str =
If you tried to supply `--another-flag` as a value rather than a flag, use `-- --another-flag` If you tried to supply `--another-flag` as a value rather than a flag, use `-- --another-flag`
Usage: Usage: mycat [OPTIONS] [filename]
mycat [OPTIONS] [filename]
For more information try --help For more information try --help
"; ";
@ -183,8 +182,7 @@ fn issue_2308_multiple_dashes() {
If you tried to supply `-----` as a value rather than a flag, use `-- -----` If you tried to supply `-----` as a value rather than a flag, use `-- -----`
Usage: Usage: test <arg>
test <arg>
For more information try --help For more information try --help
"; ";

View file

@ -5,8 +5,7 @@ use clap::{arg, error::ErrorKind, Arg, ArgAction, ArgGroup, Command, Id};
static REQ_GROUP_USAGE: &str = "error: The following required arguments were not provided: static REQ_GROUP_USAGE: &str = "error: The following required arguments were not provided:
<base|--delete> <base|--delete>
Usage: Usage: clap-test <base|--delete>
clap-test <base|--delete>
For more information try --help For more information try --help
"; ";
@ -14,8 +13,7 @@ For more information try --help
static REQ_GROUP_CONFLICT_USAGE: &str = static REQ_GROUP_CONFLICT_USAGE: &str =
"error: The argument '--delete' cannot be used with '[base]' "error: The argument '--delete' cannot be used with '[base]'
Usage: Usage: clap-test <base|--delete>
clap-test <base|--delete>
For more information try --help For more information try --help
"; ";
@ -23,8 +21,7 @@ For more information try --help
static REQ_GROUP_CONFLICT_ONLY_OPTIONS: &str = static REQ_GROUP_CONFLICT_ONLY_OPTIONS: &str =
"error: The argument '--delete' cannot be used with '--all' "error: The argument '--delete' cannot be used with '--all'
Usage: Usage: clap-test <--all|--delete>
clap-test <--all|--delete>
For more information try --help For more information try --help
"; ";
@ -262,8 +259,7 @@ fn group_overrides_required() {
#[test] #[test]
fn group_usage_use_val_name() { fn group_usage_use_val_name() {
static GROUP_USAGE_USE_VAL_NAME: &str = "\ static GROUP_USAGE_USE_VAL_NAME: &str = "\
Usage: Usage: prog <A>
prog <A>
Arguments: Arguments:
[A] [A]

View file

@ -78,8 +78,7 @@ fn help_multi_subcommand_error() {
static EXPECTED: &str = "error: The subcommand 'foo' wasn't recognized static EXPECTED: &str = "error: The subcommand 'foo' wasn't recognized
Usage: Usage: ctest subcmd multi [OPTIONS]
ctest subcmd multi [OPTIONS]
For more information try --help For more information try --help
"; ";
@ -89,8 +88,7 @@ For more information try --help
#[test] #[test]
fn req_last_arg_usage() { fn req_last_arg_usage() {
static LAST_ARG_REQ_MULT: &str = "\ static LAST_ARG_REQ_MULT: &str = "\
Usage: Usage: example <FIRST>... -- <SECOND>...
example <FIRST>... -- <SECOND>...
Arguments: Arguments:
<FIRST>... First <FIRST>... First
@ -117,8 +115,7 @@ Options:
#[test] #[test]
fn args_with_last_usage() { fn args_with_last_usage() {
static LAST_ARG_USAGE: &str = "\ static LAST_ARG_USAGE: &str = "\
Usage: Usage: flamegraph [OPTIONS] [BINFILE] [-- <ARGS>...]
flamegraph [OPTIONS] [BINFILE] [-- <ARGS>...]
Arguments: Arguments:
[BINFILE] The path of the binary to be profiled. for a binary. [BINFILE] The path of the binary to be profiled. for a binary.
@ -202,8 +199,7 @@ clap-test v1.4.8
Kevin K. <kbknapp@gmail.com> Kevin K. <kbknapp@gmail.com>
tests clap library tests clap library
Usage: Usage: clap-test [OPTIONS] [positional] [positional2] [positional3]... [COMMAND]
clap-test [OPTIONS] [positional] [positional2] [positional3]... [COMMAND]
Commands: Commands:
subcmd tests subcommands subcmd tests subcommands
@ -239,8 +235,7 @@ fn after_and_before_help_output() {
tests clap library tests clap library
Usage: Usage: clap-test
clap-test
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -264,8 +259,7 @@ fn after_and_before_long_help_output() {
tests clap library tests clap library
Usage: Usage: clap-test
clap-test
Options: Options:
-h, --help Print help information (use `--help` for more detail) -h, --help Print help information (use `--help` for more detail)
@ -278,8 +272,7 @@ some text that comes after the help
tests clap library tests clap library
Usage: Usage: clap-test
clap-test
Options: Options:
-h, --help -h, --help
@ -305,8 +298,7 @@ some longer text that comes after the help
static MULTI_SC_HELP: &str = "\ static MULTI_SC_HELP: &str = "\
tests subcommands tests subcommands
Usage: Usage: ctest subcmd multi [OPTIONS]
ctest subcmd multi [OPTIONS]
Options: Options:
-f, --flag tests flags -f, --flag tests flags
@ -342,8 +334,7 @@ fn multi_level_sc_help() {
#[test] #[test]
fn no_wrap_default_help() { fn no_wrap_default_help() {
static DEFAULT_HELP: &str = "\ static DEFAULT_HELP: &str = "\
Usage: Usage: ctest
ctest
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -358,8 +349,7 @@ Options:
#[cfg(feature = "wrap_help")] #[cfg(feature = "wrap_help")]
fn wrapped_help() { fn wrapped_help() {
static WRAPPED_HELP: &str = "\ static WRAPPED_HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-a, --all -a, --all
@ -413,8 +403,7 @@ Options:
#[cfg(feature = "wrap_help")] #[cfg(feature = "wrap_help")]
fn unwrapped_help() { fn unwrapped_help() {
static UNWRAPPED_HELP: &str = "\ static UNWRAPPED_HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-a, --all Also do versioning for private crates -a, --all Also do versioning for private crates
@ -460,8 +449,7 @@ Options:
#[cfg(all(feature = "wrap_help"))] #[cfg(all(feature = "wrap_help"))]
fn possible_value_wrapped_help() { fn possible_value_wrapped_help() {
static WRAPPED_HELP: &str = "\ static WRAPPED_HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
--possible-values <possible_values> --possible-values <possible_values>
@ -527,8 +515,7 @@ fn complex_subcommand_help_output() {
Kevin K. <kbknapp@gmail.com> Kevin K. <kbknapp@gmail.com>
tests subcommands tests subcommands
Usage: Usage: clap-test subcmd [OPTIONS] [scpositional]
clap-test subcmd [OPTIONS] [scpositional]
Arguments: Arguments:
[scpositional] tests positionals [scpositional] tests positionals
@ -548,8 +535,7 @@ Options:
#[test] #[test]
fn issue_626_unicode_cutoff() { fn issue_626_unicode_cutoff() {
static ISSUE_626_CUTOFF: &str = "\ static ISSUE_626_CUTOFF: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café is an -c, --cafe <FILE> A coffeehouse, coffee shop, or café is an
@ -583,8 +569,7 @@ Options:
} }
static HIDE_POS_VALS: &str = "\ static HIDE_POS_VALS: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-p, --pos <VAL> Some vals [possible values: fast, slow] -p, --pos <VAL> Some vals [possible values: fast, slow]
@ -650,8 +635,7 @@ fn hide_single_possible_val() {
#[test] #[test]
fn possible_vals_with_help() { fn possible_vals_with_help() {
static POS_VALS_HELP: &str = "\ static POS_VALS_HELP: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-p, --pos <VAL> -p, --pos <VAL>
@ -699,8 +683,7 @@ Options:
#[test] #[test]
fn issue_626_panic() { fn issue_626_panic() {
static ISSUE_626_PANIC: &str = "\ static ISSUE_626_PANIC: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe <FILE> -c, --cafe <FILE>
@ -754,8 +737,7 @@ fn issue_626_variable_panic() {
#[test] #[test]
fn final_word_wrapping() { fn final_word_wrapping() {
static FINAL_WORD_WRAPPING: &str = "\ static FINAL_WORD_WRAPPING: &str = "\
Usage: Usage: ctest
ctest
Options: Options:
-h, --help -h, --help
@ -773,8 +755,7 @@ Options:
} }
static WRAPPING_NEWLINE_CHARS: &str = "\ static WRAPPING_NEWLINE_CHARS: &str = "\
Usage: Usage: ctest [mode]
ctest [mode]
Arguments: Arguments:
[mode] x, max, maximum 20 characters, contains [mode] x, max, maximum 20 characters, contains
@ -827,8 +808,7 @@ fn dont_wrap_urls() {
); );
const EXPECTED: &str = "\ const EXPECTED: &str = "\
Usage: Usage: Example update [OPTIONS]
Example update [OPTIONS]
Options: Options:
--force-non-host --force-non-host
@ -845,8 +825,7 @@ Options:
} }
static OLD_NEWLINE_CHARS: &str = "\ static OLD_NEWLINE_CHARS: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-m Some help with some wrapping -m Some help with some wrapping
@ -880,8 +859,7 @@ fn old_newline_variables() {
#[test] #[test]
fn issue_688_hide_pos_vals() { fn issue_688_hide_pos_vals() {
static ISSUE_688: &str = "\ static ISSUE_688: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
--filter <filter> Sets the filter, or sampling method, to use for interpolation when resizing the particle --filter <filter> Sets the filter, or sampling method, to use for interpolation when resizing the particle
@ -932,8 +910,7 @@ fn issue_702_multiple_values() {
static ISSUE_702: &str = "\ static ISSUE_702: &str = "\
bar bar
Usage: Usage: myapp [OPTIONS] [arg1] [arg2]...
myapp [OPTIONS] [arg1] [arg2]...
Arguments: Arguments:
[arg1] some option [arg1] some option
@ -990,8 +967,7 @@ something really really long, with
multiple lines of text multiple lines of text
that should be displayed that should be displayed
Usage: Usage: myapp [arg1]
myapp [arg1]
Arguments: Arguments:
[arg1] [arg1]
@ -1019,11 +995,10 @@ Options:
#[test] #[test]
fn ripgrep_usage() { fn ripgrep_usage() {
static RIPGREP_USAGE: &str = "\ static RIPGREP_USAGE: &str = "\
Usage: Usage: rg [OPTIONS] <pattern> [<path> ...]
rg [OPTIONS] <pattern> [<path> ...] rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...]
rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...] rg [OPTIONS] --files [<path> ...]
rg [OPTIONS] --files [<path> ...] rg [OPTIONS] --type-list
rg [OPTIONS] --type-list
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -1032,9 +1007,9 @@ Options:
let cmd = Command::new("ripgrep").version("0.5").override_usage( let cmd = Command::new("ripgrep").version("0.5").override_usage(
"rg [OPTIONS] <pattern> [<path> ...] "rg [OPTIONS] <pattern> [<path> ...]
rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...] rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...]
rg [OPTIONS] --files [<path> ...] rg [OPTIONS] --files [<path> ...]
rg [OPTIONS] --type-list", rg [OPTIONS] --type-list",
); );
utils::assert_output(cmd, "rg --help", RIPGREP_USAGE, false); utils::assert_output(cmd, "rg --help", RIPGREP_USAGE, false);
@ -1045,11 +1020,10 @@ fn ripgrep_usage_using_templates() {
static RIPGREP_USAGE: &str = "\ static RIPGREP_USAGE: &str = "\
ripgrep 0.5 ripgrep 0.5
Usage: Usage: rg [OPTIONS] <pattern> [<path> ...]
rg [OPTIONS] <pattern> [<path> ...] rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...]
rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...] rg [OPTIONS] --files [<path> ...]
rg [OPTIONS] --files [<path> ...] rg [OPTIONS] --type-list
rg [OPTIONS] --type-list
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -1059,17 +1033,17 @@ Options:
let cmd = Command::new("ripgrep") let cmd = Command::new("ripgrep")
.version("0.5") .version("0.5")
.override_usage( .override_usage(
" "\
rg [OPTIONS] <pattern> [<path> ...] rg [OPTIONS] <pattern> [<path> ...]
rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...] rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...]
rg [OPTIONS] --files [<path> ...] rg [OPTIONS] --files [<path> ...]
rg [OPTIONS] --type-list", rg [OPTIONS] --type-list",
) )
.help_template( .help_template(
"\ "\
{bin} {version} {bin} {version}
Usage:{usage} Usage: {usage}
Options: Options:
{options}", {options}",
@ -1081,9 +1055,8 @@ Options:
#[test] #[test]
fn sc_negates_reqs() { fn sc_negates_reqs() {
static SC_NEGATES_REQS: &str = "\ static SC_NEGATES_REQS: &str = "\
Usage: Usage: prog --opt <FILE> [PATH]
prog --opt <FILE> [PATH] prog [PATH] <COMMAND>
prog [PATH] <COMMAND>
Commands: Commands:
test test
@ -1110,8 +1083,7 @@ Options:
#[test] #[test]
fn hide_args() { fn hide_args() {
static HIDDEN_ARGS: &str = "\ static HIDDEN_ARGS: &str = "\
Usage: Usage: prog [OPTIONS]
prog [OPTIONS]
Options: Options:
-f, --flag testing flags -f, --flag testing flags
@ -1131,9 +1103,8 @@ Options:
#[test] #[test]
fn args_negate_sc() { fn args_negate_sc() {
static ARGS_NEGATE_SC: &str = "\ static ARGS_NEGATE_SC: &str = "\
Usage: Usage: prog [OPTIONS] [PATH]
prog [OPTIONS] [PATH] prog <COMMAND>
prog <COMMAND>
Commands: Commands:
test test
@ -1162,8 +1133,7 @@ Options:
#[test] #[test]
fn issue_1046_hide_scs() { fn issue_1046_hide_scs() {
static ISSUE_1046_HIDDEN_SCS: &str = "\ static ISSUE_1046_HIDDEN_SCS: &str = "\
Usage: Usage: prog [OPTIONS] [PATH]
prog [OPTIONS] [PATH]
Arguments: Arguments:
[PATH] some [PATH] some
@ -1193,8 +1163,7 @@ email <email@server.com>
Show how the about text is not Show how the about text is not
wrapped wrapped
Usage: Usage: ctest
ctest
Options: Options:
-h, --help -h, --help
@ -1215,8 +1184,7 @@ Options:
} }
static OVERRIDE_HELP_SHORT: &str = "\ static OVERRIDE_HELP_SHORT: &str = "\
Usage: Usage: test
test
Options: Options:
-H, --help Print help information -H, --help Print help information
@ -1235,8 +1203,7 @@ fn override_help_short() {
} }
static OVERRIDE_HELP_LONG: &str = "\ static OVERRIDE_HELP_LONG: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-h, --hell Print help information -h, --hell Print help information
@ -1255,8 +1222,7 @@ fn override_help_long() {
} }
static OVERRIDE_HELP_ABOUT: &str = "\ static OVERRIDE_HELP_ABOUT: &str = "\
Usage: Usage: test
test
Options: Options:
-h, --help Print custom help information -h, --help Print custom help information
@ -1308,8 +1274,7 @@ fn arg_long_conflict_with_help() {
#[test] #[test]
fn last_arg_mult_usage() { fn last_arg_mult_usage() {
static LAST_ARG: &str = "\ static LAST_ARG: &str = "\
Usage: Usage: last <TARGET> [CORPUS] [-- <ARGS>...]
last <TARGET> [CORPUS] [-- <ARGS>...]
Arguments: Arguments:
<TARGET> some <TARGET> some
@ -1338,8 +1303,7 @@ Options:
#[test] #[test]
fn last_arg_mult_usage_req() { fn last_arg_mult_usage_req() {
static LAST_ARG_REQ: &str = "\ static LAST_ARG_REQ: &str = "\
Usage: Usage: last <TARGET> [CORPUS] -- <ARGS>...
last <TARGET> [CORPUS] -- <ARGS>...
Arguments: Arguments:
<TARGET> some <TARGET> some
@ -1369,9 +1333,8 @@ Options:
#[test] #[test]
fn last_arg_mult_usage_req_with_sc() { fn last_arg_mult_usage_req_with_sc() {
static LAST_ARG_REQ_SC: &str = "\ static LAST_ARG_REQ_SC: &str = "\
Usage: Usage: last <TARGET> [CORPUS] -- <ARGS>...
last <TARGET> [CORPUS] -- <ARGS>... last [TARGET] [CORPUS] <COMMAND>
last [TARGET] [CORPUS] <COMMAND>
Commands: Commands:
test some test some
@ -1407,9 +1370,8 @@ Options:
#[test] #[test]
fn last_arg_mult_usage_with_sc() { fn last_arg_mult_usage_with_sc() {
static LAST_ARG_SC: &str = "\ static LAST_ARG_SC: &str = "\
Usage: Usage: last <TARGET> [CORPUS] [-- <ARGS>...]
last <TARGET> [CORPUS] [-- <ARGS>...] last <COMMAND>
last <COMMAND>
Commands: Commands:
test some test some
@ -1442,8 +1404,7 @@ Options:
} }
static HIDE_DEFAULT_VAL: &str = "\ static HIDE_DEFAULT_VAL: &str = "\
Usage: Usage: default [OPTIONS]
default [OPTIONS]
Options: Options:
--arg <argument> Pass an argument to the program. [default: default-argument] --arg <argument> Pass an argument to the program. [default: default-argument]
@ -1474,8 +1435,7 @@ fn hide_default_val() {
#[test] #[test]
fn escaped_whitespace_values() { fn escaped_whitespace_values() {
static ESCAPED_DEFAULT_VAL: &str = "\ static ESCAPED_DEFAULT_VAL: &str = "\
Usage: Usage: default [OPTIONS]
default [OPTIONS]
Options: Options:
--arg <argument> Pass an argument to the program. [default: \"\\n\"] [possible values: normal, \" \", \"\\n\", \"\\t\", --arg <argument> Pass an argument to the program. [default: \"\\n\"] [possible values: normal, \" \", \"\\n\", \"\\t\",
@ -1565,8 +1525,7 @@ fn issue_1052_require_delim_help() {
static REQUIRE_DELIM_HELP: &str = "\ static REQUIRE_DELIM_HELP: &str = "\
tests stuff tests stuff
Usage: Usage: test --fake <some> <val>
test --fake <some> <val>
Options: Options:
-f, --fake <some> <val> some help -f, --fake <some> <val> some help
@ -1594,8 +1553,7 @@ fn custom_headers_headers() {
static CUSTOM_HELP_SECTION: &str = "\ static CUSTOM_HELP_SECTION: &str = "\
does stuff does stuff
Usage: Usage: test [OPTIONS] --fake <some> <val>
test [OPTIONS] --fake <some> <val>
Options: Options:
-f, --fake <some> <val> some help -f, --fake <some> <val> some help
@ -1634,8 +1592,7 @@ NETWORKING:
static MULTIPLE_CUSTOM_HELP_SECTIONS: &str = "\ static MULTIPLE_CUSTOM_HELP_SECTIONS: &str = "\
does stuff does stuff
Usage: Usage: test [OPTIONS] --fake <some> <val> --birthday-song <song> --birthday-song-volume <volume>
test [OPTIONS] --fake <some> <val> --birthday-song <song> --birthday-song-volume <volume>
Options: Options:
-f, --fake <some> <val> some help -f, --fake <some> <val> some help
@ -1714,8 +1671,7 @@ fn multiple_custom_help_headers() {
static CUSTOM_HELP_SECTION_HIDDEN_ARGS: &str = "\ static CUSTOM_HELP_SECTION_HIDDEN_ARGS: &str = "\
does stuff does stuff
Usage: Usage: test [OPTIONS] --song <song> --song-volume <volume>
test [OPTIONS] --song <song> --song-volume <volume>
Options: Options:
-h, --help Print help information (use `--help` for more detail) -h, --help Print help information (use `--help` for more detail)
@ -1766,8 +1722,7 @@ fn custom_help_headers_hide_args() {
static ISSUE_897: &str = "\ static ISSUE_897: &str = "\
Long about foo Long about foo
Usage: Usage: ctest foo
ctest foo
Options: Options:
-h, --help -h, --help
@ -1791,8 +1746,7 @@ fn show_long_about_issue_897() {
static ISSUE_897_SHORT: &str = "\ static ISSUE_897_SHORT: &str = "\
About foo About foo
Usage: Usage: ctest foo
ctest foo
Options: Options:
-h, --help Print help information (use `--help` for more detail) -h, --help Print help information (use `--help` for more detail)
@ -1813,8 +1767,7 @@ fn show_short_about_issue_897() {
#[test] #[test]
fn issue_1364_no_short_options() { fn issue_1364_no_short_options() {
static ISSUE_1364: &str = "\ static ISSUE_1364: &str = "\
Usage: Usage: demo [OPTIONS] [FILES]...
demo [OPTIONS] [FILES]...
Arguments: Arguments:
[FILES]... [FILES]...
@ -1846,8 +1799,7 @@ Options:
#[test] #[test]
fn issue_1487() { fn issue_1487() {
static ISSUE_1487: &str = "\ static ISSUE_1487: &str = "\
Usage: Usage: ctest <arg1|arg2>
ctest <arg1|arg2>
Arguments: Arguments:
[arg1] [arg1]
@ -1967,8 +1919,7 @@ fn help_required_and_no_args() {
#[test] #[test]
fn issue_1642_long_help_spacing() { fn issue_1642_long_help_spacing() {
static ISSUE_1642: &str = "\ static ISSUE_1642: &str = "\
Usage: Usage: prog [OPTIONS]
prog [OPTIONS]
Options: Options:
--config --config
@ -1996,8 +1947,7 @@ and on, so I'll stop now.",
} }
const AFTER_HELP_NO_ARGS: &str = "\ const AFTER_HELP_NO_ARGS: &str = "\
Usage: Usage: myapp
myapp
This is after help. This is after help.
"; ";
@ -2024,8 +1974,7 @@ fn help_subcmd_help() {
static HELP_SUBCMD_HELP: &str = "\ static HELP_SUBCMD_HELP: &str = "\
Print this message or the help of the given subcommand(s) Print this message or the help of the given subcommand(s)
Usage: Usage: myapp help [COMMAND]...
myapp help [COMMAND]...
Arguments: Arguments:
[COMMAND]... The subcommand whose help message to display [COMMAND]... The subcommand whose help message to display
@ -2042,8 +1991,7 @@ fn subcmd_help_subcmd_help() {
static SUBCMD_HELP_SUBCMD_HELP: &str = "\ static SUBCMD_HELP_SUBCMD_HELP: &str = "\
Print this message or the help of the given subcommand(s) Print this message or the help of the given subcommand(s)
Usage: Usage: myapp subcmd help [COMMAND]...
myapp subcmd help [COMMAND]...
Arguments: Arguments:
[COMMAND]... The subcommand whose help message to display [COMMAND]... The subcommand whose help message to display
@ -2063,8 +2011,7 @@ Arguments:
#[test] #[test]
fn global_args_should_show_on_toplevel_help_message() { fn global_args_should_show_on_toplevel_help_message() {
static HELP: &str = "\ static HELP: &str = "\
Usage: Usage: myapp [OPTIONS] [COMMAND]
myapp [OPTIONS] [COMMAND]
Commands: Commands:
subcmd\x20\x20\x20\x20 subcmd\x20\x20\x20\x20
@ -2092,8 +2039,7 @@ fn global_args_should_not_show_on_help_message_for_help_help() {
static HELP_HELP: &str = "\ static HELP_HELP: &str = "\
Print this message or the help of the given subcommand(s) Print this message or the help of the given subcommand(s)
Usage: Usage: myapp help [COMMAND]...
myapp help [COMMAND]...
Arguments: Arguments:
[COMMAND]... The subcommand whose help message to display [COMMAND]... The subcommand whose help message to display
@ -2114,8 +2060,7 @@ Arguments:
#[test] #[test]
fn global_args_should_show_on_help_message_for_subcommand() { fn global_args_should_show_on_help_message_for_subcommand() {
static HELP_SUBCMD: &str = "\ static HELP_SUBCMD: &str = "\
Usage: Usage: myapp subcmd [OPTIONS] [COMMAND]
myapp subcmd [OPTIONS] [COMMAND]
Commands: Commands:
multi\x20\x20\x20\x20 multi\x20\x20\x20\x20
@ -2141,8 +2086,7 @@ Options:
#[test] #[test]
fn global_args_should_show_on_help_message_for_nested_subcommand() { fn global_args_should_show_on_help_message_for_nested_subcommand() {
static HELP_SUB_SUBCMD: &str = "\ static HELP_SUB_SUBCMD: &str = "\
Usage: Usage: myapp subcmd multi [OPTIONS]
myapp subcmd multi [OPTIONS]
Options: Options:
-g, --some-global <someglobal>\x20\x20\x20\x20 -g, --some-global <someglobal>\x20\x20\x20\x20
@ -2165,8 +2109,7 @@ Options:
#[test] #[test]
fn option_usage_order() { fn option_usage_order() {
static OPTION_USAGE_ORDER: &str = "\ static OPTION_USAGE_ORDER: &str = "\
Usage: Usage: order [OPTIONS]
order [OPTIONS]
Options: Options:
-a -a
@ -2199,8 +2142,7 @@ Options:
#[test] #[test]
fn prefer_about_over_long_about_in_subcommands_list() { fn prefer_about_over_long_about_in_subcommands_list() {
static ABOUT_IN_COMMANDS_LIST: &str = "\ static ABOUT_IN_COMMANDS_LIST: &str = "\
Usage: Usage: about-in-subcommands-list [COMMAND]
about-in-subcommands-list [COMMAND]
Commands: Commands:
sub short about sub sub short about sub
@ -2227,8 +2169,7 @@ Options:
#[test] #[test]
fn issue_1794_usage() { fn issue_1794_usage() {
static USAGE_WITH_GROUP: &str = "\ static USAGE_WITH_GROUP: &str = "\
Usage: Usage: deno <pos1|--option1> [pos2]
deno <pos1|--option1> [pos2]
Arguments: Arguments:
[pos1] [pos1]
@ -2258,8 +2199,7 @@ Options:
} }
static CUSTOM_HEADING_POS: &str = "\ static CUSTOM_HEADING_POS: &str = "\
Usage: Usage: test [gear] [speed]
test [gear] [speed]
Arguments: Arguments:
[gear] Which gear [gear] Which gear
@ -2284,8 +2224,7 @@ fn custom_heading_pos() {
} }
static ONLY_CUSTOM_HEADING_OPTS_NO_ARGS: &str = "\ static ONLY_CUSTOM_HEADING_OPTS_NO_ARGS: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
NETWORKING: NETWORKING:
-s, --speed <SPEED> How fast -s, --speed <SPEED> How fast
@ -2305,8 +2244,7 @@ fn only_custom_heading_opts_no_args() {
} }
static ONLY_CUSTOM_HEADING_POS_NO_ARGS: &str = "\ static ONLY_CUSTOM_HEADING_POS_NO_ARGS: &str = "\
Usage: Usage: test [speed]
test [speed]
NETWORKING: NETWORKING:
[speed] How fast [speed] How fast
@ -2339,8 +2277,7 @@ fn issue_2508_number_of_values_with_single_value_name() {
cmd, cmd,
"my_app --help", "my_app --help",
"\ "\
Usage: Usage: my_app [OPTIONS]
my_app [OPTIONS]
Options: Options:
--some_arg <some_arg> <some_arg> --some_arg <some_arg> <some_arg>
@ -2361,8 +2298,7 @@ fn missing_positional_final_required() {
cmd, cmd,
"test --help", "test --help",
"\ "\
Usage: Usage: test [arg1] <arg2>
test [arg1] <arg2>
Arguments: Arguments:
[arg1] [arg1]
@ -2386,8 +2322,7 @@ fn missing_positional_final_multiple() {
cmd, cmd,
"test --help", "test --help",
"\ "\
Usage: Usage: test [foo] [bar] [baz]...
test [foo] [bar] [baz]...
Arguments: Arguments:
[foo] [foo]
@ -2413,8 +2348,7 @@ fn positional_multiple_values_is_dotted() {
cmd, cmd,
"test --help", "test --help",
"\ "\
Usage: Usage: test <foo>...
test <foo>...
Arguments: Arguments:
<foo>... <foo>...
@ -2436,8 +2370,7 @@ Options:
cmd, cmd,
"test --help", "test --help",
"\ "\
Usage: Usage: test <BAR>...
test <BAR>...
Arguments: Arguments:
<BAR>... <BAR>...
@ -2462,8 +2395,7 @@ fn positional_multiple_occurrences_is_dotted() {
cmd, cmd,
"test --help", "test --help",
"\ "\
Usage: Usage: test <foo>...
test <foo>...
Arguments: Arguments:
<foo>... <foo>...
@ -2486,8 +2418,7 @@ Options:
cmd, cmd,
"test --help", "test --help",
"\ "\
Usage: Usage: test <BAR>...
test <BAR>...
Arguments: Arguments:
<BAR>... <BAR>...
@ -2513,8 +2444,7 @@ fn too_few_value_names_is_dotted() {
cmd, cmd,
"test --help", "test --help",
"\ "\
Usage: Usage: test --foo <one> <two>...
test --foo <one> <two>...
Options: Options:
--foo <one> <two>... --foo <one> <two>...
@ -2616,8 +2546,7 @@ fn subcommand_help_doesnt_have_useless_help_flag() {
"\ "\
Print this message or the help of the given subcommand(s) Print this message or the help of the given subcommand(s)
Usage: Usage: example help [COMMAND]...
example help [COMMAND]...
Arguments: Arguments:
[COMMAND]... The subcommand whose help message to display [COMMAND]... The subcommand whose help message to display
@ -2659,8 +2588,7 @@ fn dont_propagate_version_to_help_subcommand() {
"\ "\
Print this message or the help of the given subcommand(s) Print this message or the help of the given subcommand(s)
Usage: Usage: example help [COMMAND]...
example help [COMMAND]...
Arguments: Arguments:
[COMMAND]... The subcommand whose help message to display [COMMAND]... The subcommand whose help message to display
@ -2694,8 +2622,7 @@ fn parent_cmd_req_in_usage_with_help_flag() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
some some
Usage: Usage: parent <TARGET> <ARGS> test
parent <TARGET> <ARGS> test
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -2718,8 +2645,7 @@ fn parent_cmd_req_in_usage_with_help_subcommand() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
some some
Usage: Usage: parent <TARGET> <ARGS> test
parent <TARGET> <ARGS> test
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -2742,8 +2668,7 @@ fn parent_cmd_req_in_usage_with_render_help() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
some some
Usage: Usage: parent <TARGET> <ARGS> test
parent <TARGET> <ARGS> test
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -2769,8 +2694,7 @@ Options:
#[test] #[test]
fn parent_cmd_req_ignored_when_negates_reqs() { fn parent_cmd_req_ignored_when_negates_reqs() {
static MULTI_SC_HELP: &str = "\ static MULTI_SC_HELP: &str = "\
Usage: Usage: ctest subcmd
ctest subcmd
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -2786,8 +2710,7 @@ Options:
#[test] #[test]
fn parent_cmd_req_ignored_when_conflicts() { fn parent_cmd_req_ignored_when_conflicts() {
static MULTI_SC_HELP: &str = "\ static MULTI_SC_HELP: &str = "\
Usage: Usage: ctest subcmd
ctest subcmd
Options: Options:
-h, --help Print help information -h, --help Print help information

View file

@ -7,8 +7,7 @@ use clap::{Arg, ArgAction, Command};
use super::utils; use super::utils;
static HIDE_ENV: &str = "\ static HIDE_ENV: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. -c, --cafe <FILE> A coffeehouse, coffee shop, or café.
@ -17,8 +16,7 @@ Options:
"; ";
static SHOW_ENV: &str = "\ static SHOW_ENV: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL] -c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
@ -27,8 +25,7 @@ Options:
"; ";
static HIDE_ENV_VALS: &str = "\ static HIDE_ENV_VALS: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR] -c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR]
@ -37,8 +34,7 @@ Options:
"; ";
static SHOW_ENV_VALS: &str = "\ static SHOW_ENV_VALS: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL] -c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
@ -47,8 +43,7 @@ Options:
"; ";
static HIDE_ENV_FLAG: &str = "\ static HIDE_ENV_FLAG: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe A coffeehouse, coffee shop, or café. -c, --cafe A coffeehouse, coffee shop, or café.
@ -57,8 +52,7 @@ Options:
"; ";
static SHOW_ENV_FLAG: &str = "\ static SHOW_ENV_FLAG: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL] -c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
@ -67,8 +61,7 @@ Options:
"; ";
static HIDE_ENV_VALS_FLAG: &str = "\ static HIDE_ENV_VALS_FLAG: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR] -c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR]
@ -77,8 +70,7 @@ Options:
"; ";
static SHOW_ENV_VALS_FLAG: &str = "\ static SHOW_ENV_VALS_FLAG: &str = "\
Usage: Usage: ctest [OPTIONS]
ctest [OPTIONS]
Options: Options:
-c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL] -c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]

View file

@ -5,8 +5,7 @@ use clap::{arg, Arg, ArgAction, Command};
static HIDDEN_ARGS: &str = "\ static HIDDEN_ARGS: &str = "\
tests stuff tests stuff
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-F, --flag2 some other flag -F, --flag2 some other flag
@ -33,8 +32,7 @@ fn hide_args() {
static HIDDEN_SHORT_ARGS: &str = "\ static HIDDEN_SHORT_ARGS: &str = "\
hides short args hides short args
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-v, --visible This text should be visible -v, --visible This text should be visible
@ -72,8 +70,7 @@ fn hide_short_args_long_help() {
static HIDDEN_SHORT_ARGS_LONG_HELP: &str = "\ static HIDDEN_SHORT_ARGS_LONG_HELP: &str = "\
hides short args hides short args
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-c, --config -c, --config
@ -113,8 +110,7 @@ Options:
static HIDDEN_LONG_ARGS: &str = "\ static HIDDEN_LONG_ARGS: &str = "\
hides long args hides long args
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-v, --visible -v, --visible
@ -153,8 +149,7 @@ fn hide_long_args() {
static HIDDEN_LONG_ARGS_SHORT_HELP: &str = "\ static HIDDEN_LONG_ARGS_SHORT_HELP: &str = "\
hides long args hides long args
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-c, --config Some help text describing the --config arg -c, --config Some help text describing the --config arg
@ -187,8 +182,7 @@ fn hide_long_args_short_help() {
} }
static HIDDEN_POS_ARGS: &str = "\ static HIDDEN_POS_ARGS: &str = "\
Usage: Usage: test [another]
test [another]
Arguments: Arguments:
[another] another pos [another] another pos
@ -209,8 +203,7 @@ fn hide_pos_args() {
} }
static HIDDEN_SUBCMDS: &str = "\ static HIDDEN_SUBCMDS: &str = "\
Usage: Usage: test
test
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -227,8 +220,7 @@ fn hide_subcmds() {
} }
static HIDDEN_OPT_ARGS_ONLY: &str = "\ static HIDDEN_OPT_ARGS_ONLY: &str = "\
Usage: Usage: test
test
After help After help
"; ";
@ -252,8 +244,7 @@ fn hide_opt_args_only() {
} }
static HIDDEN_POS_ARGS_ONLY: &str = "\ static HIDDEN_POS_ARGS_ONLY: &str = "\
Usage: Usage: test
test
After help After help
"; ";
@ -273,8 +264,7 @@ fn hide_pos_args_only() {
} }
static HIDDEN_SUBCMDS_ONLY: &str = "\ static HIDDEN_SUBCMDS_ONLY: &str = "\
Usage: Usage: test
test
After help After help
"; ";

View file

@ -429,8 +429,7 @@ fn optional_value() {
let mut help = Vec::new(); let mut help = Vec::new();
cmd.write_help(&mut help).unwrap(); cmd.write_help(&mut help).unwrap();
const HELP: &str = "\ const HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-p [<NUM>] -p [<NUM>]

View file

@ -10,8 +10,7 @@ static DYM: &str =
If you tried to supply `--optio` as a value rather than a flag, use `-- --optio` If you tried to supply `--optio` as a value rather than a flag, use `-- --optio`
Usage: Usage: clap-test --option <opt>... [positional] [positional2] [positional3]...
clap-test --option <opt>... [positional] [positional2] [positional3]...
For more information try --help For more information try --help
"; ";
@ -24,8 +23,7 @@ static DYM_ISSUE_1073: &str =
If you tried to supply `--files-without-matches` as a value rather than a flag, use `-- --files-without-matches` If you tried to supply `--files-without-matches` as a value rather than a flag, use `-- --files-without-matches`
Usage: Usage: ripgrep-616 --files-without-match
ripgrep-616 --files-without-match
For more information try --help For more information try --help
"; ";
@ -50,8 +48,7 @@ fn require_equals_fail_message() {
static NO_EQUALS: &str = static NO_EQUALS: &str =
"error: Equal sign is needed when assigning values to '--config=<cfg>'. "error: Equal sign is needed when assigning values to '--config=<cfg>'.
Usage: Usage: prog [OPTIONS]
prog [OPTIONS]
For more information try --help For more information try --help
"; ";

View file

@ -211,13 +211,13 @@ fn positional_hyphen_does_not_panic() {
#[test] #[test]
fn single_positional_usage_string() { fn single_positional_usage_string() {
let mut cmd = Command::new("test").arg(arg!([FILE] "some file")); let mut cmd = Command::new("test").arg(arg!([FILE] "some file"));
crate::utils::assert_eq(cmd.render_usage(), "Usage:\n test [FILE]"); crate::utils::assert_eq(cmd.render_usage(), "Usage: test [FILE]");
} }
#[test] #[test]
fn single_positional_multiple_usage_string() { fn single_positional_multiple_usage_string() {
let mut cmd = Command::new("test").arg(arg!([FILE]... "some file")); let mut cmd = Command::new("test").arg(arg!([FILE]... "some file"));
crate::utils::assert_eq(cmd.render_usage(), "Usage:\n test [FILE]..."); crate::utils::assert_eq(cmd.render_usage(), "Usage: test [FILE]...");
} }
#[test] #[test]
@ -228,8 +228,7 @@ fn multiple_positional_usage_string() {
crate::utils::assert_eq( crate::utils::assert_eq(
cmd.render_usage(), cmd.render_usage(),
"\ "\
Usage: Usage: test [FILE] [FILES]...",
test [FILE] [FILES]...",
); );
} }
@ -238,13 +237,13 @@ fn multiple_positional_one_required_usage_string() {
let mut cmd = Command::new("test") let mut cmd = Command::new("test")
.arg(arg!(<FILE> "some file")) .arg(arg!(<FILE> "some file"))
.arg(arg!([FILES]... "some file")); .arg(arg!([FILES]... "some file"));
crate::utils::assert_eq(cmd.render_usage(), "Usage:\n test <FILE> [FILES]..."); crate::utils::assert_eq(cmd.render_usage(), "Usage: test <FILE> [FILES]...");
} }
#[test] #[test]
fn single_positional_required_usage_string() { fn single_positional_required_usage_string() {
let mut cmd = Command::new("test").arg(arg!(<FILE> "some file")); let mut cmd = Command::new("test").arg(arg!(<FILE> "some file"));
crate::utils::assert_eq(cmd.render_usage(), "Usage:\n test <FILE>"); crate::utils::assert_eq(cmd.render_usage(), "Usage: test <FILE>");
} }
// This tests a programmer error and will only succeed with debug_assertions // This tests a programmer error and will only succeed with debug_assertions

View file

@ -6,8 +6,7 @@ use clap::{arg, error::ErrorKind, Arg, ArgAction, ArgGroup, Command};
static REQUIRE_EQUALS: &str = "error: The following required arguments were not provided: static REQUIRE_EQUALS: &str = "error: The following required arguments were not provided:
--opt=<FILE> --opt=<FILE>
Usage: Usage: clap-test --opt=<FILE>
clap-test --opt=<FILE>
For more information try --help For more information try --help
"; ";
@ -15,8 +14,7 @@ For more information try --help
static REQUIRE_EQUALS_FILTERED: &str = "error: The following required arguments were not provided: static REQUIRE_EQUALS_FILTERED: &str = "error: The following required arguments were not provided:
--opt=<FILE> --opt=<FILE>
Usage: Usage: clap-test --opt=<FILE> --foo=<FILE>
clap-test --opt=<FILE> --foo=<FILE>
For more information try --help For more information try --help
"; ";
@ -25,8 +23,7 @@ static REQUIRE_EQUALS_FILTERED_GROUP: &str =
"error: The following required arguments were not provided: "error: The following required arguments were not provided:
--opt=<FILE> --opt=<FILE>
Usage: Usage: clap-test --opt=<FILE> --foo=<FILE> <--g1=<FILE>|--g2=<FILE>>
clap-test --opt=<FILE> --foo=<FILE> <--g1=<FILE>|--g2=<FILE>>
For more information try --help For more information try --help
"; ";
@ -36,8 +33,7 @@ static MISSING_REQ: &str = "error: The following required arguments were not pro
<positional> <positional>
<positional2> <positional2>
Usage: Usage: clap-test --long-option-2 <option2> -F <positional> <positional2> [positional3]...
clap-test --long-option-2 <option2> -F <positional> <positional2> [positional3]...
For more information try --help For more information try --help
"; ";
@ -45,8 +41,7 @@ For more information try --help
static COND_REQ_IN_USAGE: &str = "error: The following required arguments were not provided: static COND_REQ_IN_USAGE: &str = "error: The following required arguments were not provided:
--output <output> --output <output>
Usage: Usage: test --target <target> --input <input> --output <output>
test --target <target> --input <input> --output <output>
For more information try --help For more information try --help
"; ";
@ -141,8 +136,7 @@ static POSITIONAL_REQ: &str = "error: The following required arguments were not
<flag> <flag>
<opt> <opt>
Usage: Usage: clap-test <flag> <opt> [bar]
clap-test <flag> <opt> [bar]
For more information try --help For more information try --help
"; ";
@ -160,8 +154,7 @@ fn positional_required_with_requires_if_no_value() {
static POSITIONAL_REQ_IF_NO_VAL: &str = "error: The following required arguments were not provided: static POSITIONAL_REQ_IF_NO_VAL: &str = "error: The following required arguments were not provided:
<flag> <flag>
Usage: Usage: clap-test <flag> [opt] [bar]
clap-test <flag> [opt] [bar]
For more information try --help For more information try --help
"; ";
@ -181,8 +174,7 @@ static POSITIONAL_REQ_IF_VAL: &str = "error: The following required arguments we
<foo> <foo>
<opt> <opt>
Usage: Usage: clap-test <flag> <foo> <opt> [bar]
clap-test <flag> <foo> <opt> [bar]
For more information try --help For more information try --help
"; ";
@ -1031,8 +1023,7 @@ static ISSUE_1158: &str = "error: The following required arguments were not prov
-y <Y> -y <Y>
-z <Z> -z <Z>
Usage: Usage: example -x <X> -y <Y> -z <Z> <ID>
example -x <X> -y <Y> -z <Z> <ID>
For more information try --help For more information try --help
"; ";
@ -1067,8 +1058,7 @@ fn multiple_required_unless_usage_printing() {
--a <a> --a <a>
--b <b> --b <b>
Usage: Usage: test --c <c> --a <a> --b <b>
test --c <c> --a <a> --b <b>
For more information try --help For more information try --help
"; ";
@ -1435,8 +1425,7 @@ fn required_error_doesnt_duplicate() {
const EXPECTED: &str = "\ const EXPECTED: &str = "\
error: The argument '-b <b>' cannot be used with '-c <c>' error: The argument '-b <b>' cannot be used with '-c <c>'
Usage: Usage: clap-test -b <b> <a>
clap-test -b <b> <a>
For more information try --help For more information try --help
"; ";
@ -1458,8 +1447,7 @@ fn required_require_with_group_shows_flag() {
error: The following required arguments were not provided: error: The following required arguments were not provided:
--first --first
Usage: Usage: test --require-first <--first|--second>
test --require-first <--first|--second>
For more information try --help For more information try --help
"; ";

View file

@ -3,8 +3,7 @@ use super::utils;
use clap::{arg, error::ErrorKind, Arg, ArgAction, Command}; use clap::{arg, error::ErrorKind, Arg, ArgAction, Command};
static VISIBLE_ALIAS_HELP: &str = "\ static VISIBLE_ALIAS_HELP: &str = "\
Usage: Usage: clap-test [COMMAND]
clap-test [COMMAND]
Commands: Commands:
test Some help [aliases: dongle, done] test Some help [aliases: dongle, done]
@ -16,8 +15,7 @@ Options:
"; ";
static INVISIBLE_ALIAS_HELP: &str = "\ static INVISIBLE_ALIAS_HELP: &str = "\
Usage: Usage: clap-test [COMMAND]
clap-test [COMMAND]
Commands: Commands:
test Some help test Some help
@ -35,8 +33,7 @@ static DYM_SUBCMD: &str = "error: The subcommand 'subcm' wasn't recognized
If you believe you received this message in error, try re-running with 'dym -- subcm' If you believe you received this message in error, try re-running with 'dym -- subcm'
Usage: Usage: dym [COMMAND]
dym [COMMAND]
For more information try --help For more information try --help
"; ";
@ -48,8 +45,7 @@ static DYM_SUBCMD_AMBIGUOUS: &str = "error: The subcommand 'te' wasn't recognize
If you believe you received this message in error, try re-running with 'dym -- te' If you believe you received this message in error, try re-running with 'dym -- te'
Usage: Usage: dym [COMMAND]
dym [COMMAND]
For more information try --help For more information try --help
"; ";
@ -59,8 +55,7 @@ static SUBCMD_AFTER_DOUBLE_DASH: &str =
If you tried to supply `subcmd` as a subcommand, remove the '--' before it. If you tried to supply `subcmd` as a subcommand, remove the '--' before it.
Usage: Usage: cmd [COMMAND]
cmd [COMMAND]
For more information try --help For more information try --help
"; ";
@ -181,8 +176,7 @@ fn subcmd_did_you_mean_output_arg() {
If you tried to supply `--subcmarg` as a value rather than a flag, use `-- --subcmarg` If you tried to supply `--subcmarg` as a value rather than a flag, use `-- --subcmarg`
Usage: Usage: dym [COMMAND]
dym [COMMAND]
For more information try --help For more information try --help
"; ";
@ -202,8 +196,7 @@ fn subcmd_did_you_mean_output_arg_false_positives() {
If you tried to supply `--subcmarg` as a value rather than a flag, use `-- --subcmarg` If you tried to supply `--subcmarg` as a value rather than a flag, use `-- --subcmarg`
Usage: Usage: dym [COMMAND]
dym [COMMAND]
For more information try --help For more information try --help
"; ";
@ -356,7 +349,7 @@ fn subcommand_placeholder_test() {
.subcommand_value_name("TEST_PLACEHOLDER") .subcommand_value_name("TEST_PLACEHOLDER")
.subcommand_help_heading("TEST_HEADER"); .subcommand_help_heading("TEST_HEADER");
assert_eq!(&cmd.render_usage(), "Usage:\n myprog [TEST_PLACEHOLDER]"); assert_eq!(&cmd.render_usage(), "Usage: myprog [TEST_PLACEHOLDER]");
let mut help_text = Vec::new(); let mut help_text = Vec::new();
cmd.write_help(&mut help_text) cmd.write_help(&mut help_text)
@ -438,8 +431,7 @@ fn subcommand_not_recognized() {
"fake help", "fake help",
"error: The subcommand 'help' wasn't recognized "error: The subcommand 'help' wasn't recognized
Usage: Usage: fake [COMMAND]
fake [COMMAND]
For more information try --help For more information try --help
", ",
@ -515,8 +507,7 @@ fn bad_multicall_command_error() {
static HELLO_EXPECTED: &str = "\ static HELLO_EXPECTED: &str = "\
error: The subcommand 'world' wasn't recognized error: The subcommand 'world' wasn't recognized
Usage: Usage: <COMMAND>
<COMMAND>
For more information try help For more information try help
"; ";
@ -533,8 +524,7 @@ error: The subcommand 'baz' wasn't recognized
If you believe you received this message in error, try re-running with ' -- baz' If you believe you received this message in error, try re-running with ' -- baz'
Usage: Usage: <COMMAND>
<COMMAND>
For more information try help For more information try help
"; ";
@ -572,8 +562,7 @@ fn cant_have_args_with_multicall() {
#[test] #[test]
fn multicall_help_flag() { fn multicall_help_flag() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
Usage: Usage: foo bar [value]
foo bar [value]
Arguments: Arguments:
[value] [value]
@ -593,8 +582,7 @@ Options:
#[test] #[test]
fn multicall_help_subcommand() { fn multicall_help_subcommand() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
Usage: Usage: foo bar [value]
foo bar [value]
Arguments: Arguments:
[value] [value]
@ -614,8 +602,7 @@ Options:
#[test] #[test]
fn multicall_render_help() { fn multicall_render_help() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
Usage: Usage: foo bar [value]
foo bar [value]
Arguments: Arguments:
[value] [value]

View file

@ -6,8 +6,7 @@ static EXAMPLE1_TMPL_S: &str = "{bin} {version}
{author} {author}
{about} {about}
Usage: Usage: {usage}
{usage}
{all-args}"; {all-args}";
@ -15,8 +14,7 @@ static EXAMPLE1_TMPS_F: &str = "{bin} {version}
{author} {author}
{about} {about}
Usage: Usage: {usage}
{usage}
Options: Options:
{options} {options}
@ -29,8 +27,7 @@ static CUSTOM_TEMPL_HELP: &str = "MyApp 1.0
Kevin K. <kbknapp@gmail.com> Kevin K. <kbknapp@gmail.com>
Does awesome things Does awesome things
Usage: Usage: MyApp [OPTIONS] <output> [COMMAND]
MyApp [OPTIONS] <output> [COMMAND]
Options: Options:
-c, --config <FILE> Sets a custom config file -c, --config <FILE> Sets a custom config file
@ -48,8 +45,7 @@ static SIMPLE_TEMPLATE: &str = "MyApp 1.0
Kevin K. <kbknapp@gmail.com> Kevin K. <kbknapp@gmail.com>
Does awesome things Does awesome things
Usage: Usage: MyApp [OPTIONS] <output> [COMMAND]
MyApp [OPTIONS] <output> [COMMAND]
Commands: Commands:
test does testing things test does testing things

View file

@ -8,8 +8,7 @@ use clap::{arg, Arg, ArgAction, ArgGroup, Command};
pub const FULL_TEMPLATE: &str = "\ pub const FULL_TEMPLATE: &str = "\
{before-help}{name} {version} {before-help}{name} {version}
{author-with-newline}{about-with-newline} {author-with-newline}{about-with-newline}
{usage-heading} {usage-heading} {usage}
{tab}{usage}
{all-args}{after-help}"; {all-args}{after-help}";

View file

@ -105,8 +105,7 @@ fn help_short_flag_no_version() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
foo foo
Usage: Usage: foo
foo
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -120,8 +119,7 @@ fn help_long_flag_no_version() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
foo foo
Usage: Usage: foo
foo
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -135,8 +133,7 @@ fn help_short_flag_with_version() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
foo 3.0 foo 3.0
Usage: Usage: foo
foo
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -151,8 +148,7 @@ fn help_long_flag_with_version() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
foo 3.0 foo 3.0
Usage: Usage: foo
foo
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -167,8 +163,7 @@ fn help_short_flag_with_long_version() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
foo 3.0 (abcdefg) foo 3.0 (abcdefg)
Usage: Usage: foo
foo
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -183,8 +178,7 @@ fn help_long_flag_with_long_version() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
foo 3.0 (abcdefg) foo 3.0 (abcdefg)
Usage: Usage: foo
foo
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -199,8 +193,7 @@ fn help_short_flag_with_both() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
foo 3.0 foo 3.0
Usage: Usage: foo
foo
Options: Options:
-h, --help Print help information -h, --help Print help information
@ -215,8 +208,7 @@ fn help_long_flag_with_both() {
static EXPECTED: &str = "\ static EXPECTED: &str = "\
foo 3.0 foo 3.0
Usage: Usage: foo
foo
Options: Options:
-h, --help Print help information -h, --help Print help information

View file

@ -220,9 +220,8 @@ fn derive_generated_error_has_full_context() {
let expected = r#"error: The following required argument was not provided: req_str let expected = r#"error: The following required argument was not provided: req_str
Usage: Usage: clap --req-str <REQ_STR>
clap --req-str <REQ_STR> clap <COMMAND>
clap <COMMAND>
For more information try --help For more information try --help
"#; "#;
@ -232,8 +231,7 @@ For more information try --help
#[test] #[test]
fn derive_order_next_order() { fn derive_order_next_order() {
static HELP: &str = "\ static HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
--flag-b first flag --flag-b first flag
@ -287,8 +285,7 @@ Options:
#[test] #[test]
fn derive_order_next_order_flatten() { fn derive_order_next_order_flatten() {
static HELP: &str = "\ static HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
--flag-b first flag --flag-b first flag
@ -342,8 +339,7 @@ Options:
#[test] #[test]
fn derive_order_no_next_order() { fn derive_order_no_next_order() {
static HELP: &str = "\ static HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
--flag-a first flag --flag-a first flag
@ -398,8 +394,7 @@ fn derive_possible_value_help() {
static HELP: &str = "\ static HELP: &str = "\
Application help Application help
Usage: Usage: clap <ARG>
clap <ARG>
Arguments: Arguments:
<ARG> <ARG>

View file

@ -10,8 +10,7 @@ use clap::CommandFactory;
pub const FULL_TEMPLATE: &str = "\ pub const FULL_TEMPLATE: &str = "\
{before-help}{name} {version} {before-help}{name} {version}
{author-with-newline}{about-with-newline} {author-with-newline}{about-with-newline}
{usage-heading} {usage-heading} {usage}
{tab}{usage}
{all-args}{after-help}"; {all-args}{after-help}";

View file

@ -301,8 +301,7 @@ mod arg {
let mut help = Vec::new(); let mut help = Vec::new();
cmd.write_help(&mut help).unwrap(); cmd.write_help(&mut help).unwrap();
const HELP: &str = "\ const HELP: &str = "\
Usage: Usage: test [OPTIONS]
test [OPTIONS]
Options: Options:
-p [<NUM>] -p [<NUM>]

View file

@ -3,8 +3,7 @@ args = []
status.code = 2 status.code = 2
stdout = "" stdout = ""
stderr = """ stderr = """
Usage: Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
stdio-fixture[EXE] [OPTIONS] [COMMAND]
Commands: Commands:
more more

View file

@ -7,8 +7,7 @@ error: Found argument '--unknown-argument' which wasn't expected, or isn't valid
If you tried to supply `--unknown-argument` as a value rather than a flag, use `-- --unknown-argument` If you tried to supply `--unknown-argument` as a value rather than a flag, use `-- --unknown-argument`
Usage: Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
stdio-fixture[EXE] [OPTIONS] [COMMAND]
For more information try --help For more information try --help
""" """

View file

@ -2,8 +2,7 @@ bin.name = "stdio-fixture"
args = ["-h"] args = ["-h"]
status.code = 0 status.code = 0
stdout = """ stdout = """
Usage: Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
stdio-fixture[EXE] [OPTIONS] [COMMAND]
Commands: Commands:
more more

View file

@ -2,8 +2,7 @@ bin.name = "stdio-fixture"
args = ["help"] args = ["help"]
status.code = 0 status.code = 0
stdout = """ stdout = """
Usage: Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
stdio-fixture[EXE] [OPTIONS] [COMMAND]
Commands: Commands:
more more

View file

@ -2,8 +2,7 @@ bin.name = "stdio-fixture"
args = ["--help"] args = ["--help"]
status.code = 0 status.code = 0
stdout = """ stdout = """
Usage: Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
stdio-fixture[EXE] [OPTIONS] [COMMAND]
Commands: Commands:
more more