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:
```console
$ cargo-example-derive --help
Usage:
cargo <COMMAND>
Usage: cargo <COMMAND>
Commands:
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
A simple to use, efficient, and full-featured Command Line Argument Parser
Usage:
cargo example-derive [OPTIONS]
Usage: cargo example-derive [OPTIONS]
Options:
--manifest-path <MANIFEST_PATH>

View file

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

View file

@ -2,8 +2,7 @@
$ demo --help
A simple to use, efficient, and full-featured Command Line Argument Parser
Usage:
demo[EXE] [OPTIONS] --name <NAME>
Usage: demo[EXE] [OPTIONS] --name <NAME>
Options:
-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
A simple to use, efficient, and full-featured Command Line Argument Parser
Usage:
custom-bool[EXE] [OPTIONS] --foo <FOO> <BOOM>
Usage: custom-bool[EXE] [OPTIONS] --foo <FOO> <BOOM>
Arguments:
<BOOM> [possible values: true, false]
@ -24,8 +23,7 @@ error: The following required arguments were not provided:
--foo <FOO>
<BOOM>
Usage:
custom-bool[EXE] --foo <FOO> <BOOM>
Usage: custom-bool[EXE] --foo <FOO> <BOOM>
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`
Usage:
interop_augment_args[EXE] [OPTIONS]
Usage: interop_augment_args[EXE] [OPTIONS]
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`
Usage:
interop_augment_subcommands[EXE] derived [OPTIONS]
Usage: interop_augment_subcommands[EXE] derived [OPTIONS]
For more information try --help
@ -89,8 +87,7 @@ $ interop_augment_subcommands unknown
? failed
error: Found argument 'unknown' which wasn't expected, or isn't valid in this context
Usage:
interop_augment_subcommands[EXE] [COMMAND]
Usage: interop_augment_subcommands[EXE] [COMMAND]
For more information try --help
@ -101,8 +98,7 @@ For more information try --help
```console
$ interop_hand_subcommand
? failed
Usage:
interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
Commands:
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`
Usage:
interop_hand_subcommand[EXE] add [NAME]...
Usage: interop_hand_subcommand[EXE] add [NAME]...
For more information try --help
@ -196,8 +191,7 @@ $ interop_hand_subcommand unknown
? failed
error: Found argument 'unknown' which wasn't expected, or isn't valid in this context
Usage:
interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
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`
Usage:
interop_flatten_hand_args[EXE] [OPTIONS]
Usage: interop_flatten_hand_args[EXE] [OPTIONS]
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
A simple to use, efficient, and full-featured Command Line Argument Parser
Usage:
escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
Usage: escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
Arguments:
[SLOP]...
@ -36,8 +35,7 @@ $ escaped-positional-derive foo bar
? failed
error: Found argument 'foo' which wasn't expected, or isn't valid in this context
Usage:
escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
Usage: escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
For more information try --help

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2536,8 +2536,7 @@ impl Command {
/// ```text
/// cust-ord
///
/// Usage:
/// cust-ord [OPTIONS]
/// Usage: cust-ord [OPTIONS]
///
/// Commands:
/// beta I should be first!
@ -3004,8 +3003,7 @@ impl Command {
/// ```text
/// myprog
///
/// Usage:
/// myprog [COMMAND]
/// Usage: myprog [COMMAND]
///
/// Commands:
/// help Print this message or the help of the given subcommand(s)
@ -3032,16 +3030,15 @@ impl Command {
/// ```text
/// myprog
///
/// Usage:
/// myprog [THING]
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// Usage: myprog [THING]
///
/// Commands:
/// help Print this message or the help of the given subcommand(s)
/// sub1
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ```
#[must_use]
pub fn subcommand_value_name(mut self, value_name: impl Into<Str>) -> Self {
@ -3070,16 +3067,15 @@ impl Command {
/// ```text
/// myprog
///
/// Usage:
/// myprog [COMMAND]
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// Usage: myprog [COMMAND]
///
/// Commands:
/// help Print this message or the help of the given subcommand(s)
/// sub1
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ```
///
/// but usage of `subcommand_help_heading`
@ -3098,16 +3094,15 @@ impl Command {
/// ```text
/// myprog
///
/// Usage:
/// myprog [COMMAND]
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// Usage: myprog [COMMAND]
///
/// Things:
/// help Print this message or the help of the given subcommand(s)
/// sub1
///
/// Options:
/// -h, --help Print help information
/// -V, --version Print version information
/// ```
#[must_use]
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> {
const DEFAULT_TEMPLATE: &'static str = "\
{before-help}{about-with-newline}
{usage-heading}
{tab}{usage}
{usage-heading} {usage}
{all-args}{after-help}\
";
const DEFAULT_NO_ARGS_TEMPLATE: &'static str = "\
{before-help}{about-with-newline}
{usage-heading}
{tab}{usage}{after-help}\
{usage-heading} {usage}{after-help}\
";
/// Create a new `Help` instance.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,8 +10,7 @@ fn very_large_display_order() {
cmd,
"test --help",
"\
Usage:
test [COMMAND]
Usage: test [COMMAND]
Commands:
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};
static HELP: &str = "\
Usage:
prog [OPTIONS]
Usage: prog [OPTIONS]
Options:
-a
@ -14,8 +13,7 @@ Options:
static ONLY_B_ERROR: &str = "error: The following required arguments were not provided:
-c
Usage:
prog -b -c
Usage: prog -b -c
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:
-b
Usage:
prog -c -b
Usage: prog -c -b
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 =
"error: Equal sign is needed when assigning values to '--config=<config>'.
Usage:
config [OPTIONS]
Usage: config [OPTIONS]
For more information try --help
";

View file

@ -25,8 +25,7 @@ fn assert_error<F: clap::error::ErrorFormatter>(
fn app_error() {
static MESSAGE: &str = "error: Failed for mysterious reasons
Usage:
test [OPTIONS] --all
Usage: test [OPTIONS] --all
For more information try --help
";
@ -89,8 +88,7 @@ fn null_prints_help() {
let err = res.unwrap_err();
let expected_kind = ErrorKind::DisplayHelp;
static MESSAGE: &str = "\
Usage:
test
Usage: test
Options:
-h, --help Print help information
@ -108,8 +106,7 @@ fn raw_prints_help() {
let err = res.unwrap_err();
let expected_kind = ErrorKind::DisplayHelp;
static MESSAGE: &str = "\
Usage:
test
Usage: test
Options:
-h, --help Print help information
@ -140,8 +137,7 @@ fn rich_formats_validation_error() {
static MESSAGE: &str = "\
error: Found argument 'unused' which wasn't expected, or isn't valid in this context
Usage:
test
Usage: test
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
Invalid Argument: unused
Usage:
test
Usage: test
";
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 = "\
Query the package database.
Usage:
pacman {query|--query|-Q} [OPTIONS]
Usage: pacman {query|--query|-Q} [OPTIONS]
Options:
-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 = "\
Query the package database.
Usage:
pacman {query|--query} [OPTIONS]
Usage: pacman {query|--query} [OPTIONS]
Options:
-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 = "\
Query the package database.
Usage:
pacman {query|-Q} [OPTIONS]
Usage: pacman {query|-Q} [OPTIONS]
Options:
-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`
Usage:
mycat [OPTIONS] [filename]
Usage: mycat [OPTIONS] [filename]
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 `-- -----`
Usage:
test <arg>
Usage: test <arg>
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:
<base|--delete>
Usage:
clap-test <base|--delete>
Usage: clap-test <base|--delete>
For more information try --help
";
@ -14,8 +13,7 @@ For more information try --help
static REQ_GROUP_CONFLICT_USAGE: &str =
"error: The argument '--delete' cannot be used with '[base]'
Usage:
clap-test <base|--delete>
Usage: clap-test <base|--delete>
For more information try --help
";
@ -23,8 +21,7 @@ For more information try --help
static REQ_GROUP_CONFLICT_ONLY_OPTIONS: &str =
"error: The argument '--delete' cannot be used with '--all'
Usage:
clap-test <--all|--delete>
Usage: clap-test <--all|--delete>
For more information try --help
";
@ -262,8 +259,7 @@ fn group_overrides_required() {
#[test]
fn group_usage_use_val_name() {
static GROUP_USAGE_USE_VAL_NAME: &str = "\
Usage:
prog <A>
Usage: prog <A>
Arguments:
[A]

View file

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

View file

@ -7,8 +7,7 @@ use clap::{Arg, ArgAction, Command};
use super::utils;
static HIDE_ENV: &str = "\
Usage:
ctest [OPTIONS]
Usage: ctest [OPTIONS]
Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café.
@ -17,8 +16,7 @@ Options:
";
static SHOW_ENV: &str = "\
Usage:
ctest [OPTIONS]
Usage: ctest [OPTIONS]
Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
@ -27,8 +25,7 @@ Options:
";
static HIDE_ENV_VALS: &str = "\
Usage:
ctest [OPTIONS]
Usage: ctest [OPTIONS]
Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR]
@ -37,8 +34,7 @@ Options:
";
static SHOW_ENV_VALS: &str = "\
Usage:
ctest [OPTIONS]
Usage: ctest [OPTIONS]
Options:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
@ -47,8 +43,7 @@ Options:
";
static HIDE_ENV_FLAG: &str = "\
Usage:
ctest [OPTIONS]
Usage: ctest [OPTIONS]
Options:
-c, --cafe A coffeehouse, coffee shop, or café.
@ -57,8 +52,7 @@ Options:
";
static SHOW_ENV_FLAG: &str = "\
Usage:
ctest [OPTIONS]
Usage: ctest [OPTIONS]
Options:
-c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
@ -67,8 +61,7 @@ Options:
";
static HIDE_ENV_VALS_FLAG: &str = "\
Usage:
ctest [OPTIONS]
Usage: ctest [OPTIONS]
Options:
-c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR]
@ -77,8 +70,7 @@ Options:
";
static SHOW_ENV_VALS_FLAG: &str = "\
Usage:
ctest [OPTIONS]
Usage: ctest [OPTIONS]
Options:
-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 = "\
tests stuff
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
-F, --flag2 some other flag
@ -33,8 +32,7 @@ fn hide_args() {
static HIDDEN_SHORT_ARGS: &str = "\
hides short args
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
-v, --visible This text should be visible
@ -72,8 +70,7 @@ fn hide_short_args_long_help() {
static HIDDEN_SHORT_ARGS_LONG_HELP: &str = "\
hides short args
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
-c, --config
@ -113,8 +110,7 @@ Options:
static HIDDEN_LONG_ARGS: &str = "\
hides long args
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
-v, --visible
@ -153,8 +149,7 @@ fn hide_long_args() {
static HIDDEN_LONG_ARGS_SHORT_HELP: &str = "\
hides long args
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
-c, --config Some help text describing the --config arg
@ -187,8 +182,7 @@ fn hide_long_args_short_help() {
}
static HIDDEN_POS_ARGS: &str = "\
Usage:
test [another]
Usage: test [another]
Arguments:
[another] another pos
@ -209,8 +203,7 @@ fn hide_pos_args() {
}
static HIDDEN_SUBCMDS: &str = "\
Usage:
test
Usage: test
Options:
-h, --help Print help information
@ -227,8 +220,7 @@ fn hide_subcmds() {
}
static HIDDEN_OPT_ARGS_ONLY: &str = "\
Usage:
test
Usage: test
After help
";
@ -252,8 +244,7 @@ fn hide_opt_args_only() {
}
static HIDDEN_POS_ARGS_ONLY: &str = "\
Usage:
test
Usage: test
After help
";
@ -273,8 +264,7 @@ fn hide_pos_args_only() {
}
static HIDDEN_SUBCMDS_ONLY: &str = "\
Usage:
test
Usage: test
After help
";

View file

@ -429,8 +429,7 @@ fn optional_value() {
let mut help = Vec::new();
cmd.write_help(&mut help).unwrap();
const HELP: &str = "\
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
-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`
Usage:
clap-test --option <opt>... [positional] [positional2] [positional3]...
Usage: clap-test --option <opt>... [positional] [positional2] [positional3]...
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`
Usage:
ripgrep-616 --files-without-match
Usage: ripgrep-616 --files-without-match
For more information try --help
";
@ -50,8 +48,7 @@ fn require_equals_fail_message() {
static NO_EQUALS: &str =
"error: Equal sign is needed when assigning values to '--config=<cfg>'.
Usage:
prog [OPTIONS]
Usage: prog [OPTIONS]
For more information try --help
";

View file

@ -211,13 +211,13 @@ fn positional_hyphen_does_not_panic() {
#[test]
fn single_positional_usage_string() {
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]
fn single_positional_multiple_usage_string() {
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]
@ -228,8 +228,7 @@ fn multiple_positional_usage_string() {
crate::utils::assert_eq(
cmd.render_usage(),
"\
Usage:
test [FILE] [FILES]...",
Usage: test [FILE] [FILES]...",
);
}
@ -238,13 +237,13 @@ fn multiple_positional_one_required_usage_string() {
let mut cmd = Command::new("test")
.arg(arg!(<FILE> "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]
fn single_positional_required_usage_string() {
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

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

View file

@ -3,8 +3,7 @@ use super::utils;
use clap::{arg, error::ErrorKind, Arg, ArgAction, Command};
static VISIBLE_ALIAS_HELP: &str = "\
Usage:
clap-test [COMMAND]
Usage: clap-test [COMMAND]
Commands:
test Some help [aliases: dongle, done]
@ -16,8 +15,7 @@ Options:
";
static INVISIBLE_ALIAS_HELP: &str = "\
Usage:
clap-test [COMMAND]
Usage: clap-test [COMMAND]
Commands:
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'
Usage:
dym [COMMAND]
Usage: dym [COMMAND]
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'
Usage:
dym [COMMAND]
Usage: dym [COMMAND]
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.
Usage:
cmd [COMMAND]
Usage: cmd [COMMAND]
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`
Usage:
dym [COMMAND]
Usage: dym [COMMAND]
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`
Usage:
dym [COMMAND]
Usage: dym [COMMAND]
For more information try --help
";
@ -356,7 +349,7 @@ fn subcommand_placeholder_test() {
.subcommand_value_name("TEST_PLACEHOLDER")
.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();
cmd.write_help(&mut help_text)
@ -438,8 +431,7 @@ fn subcommand_not_recognized() {
"fake help",
"error: The subcommand 'help' wasn't recognized
Usage:
fake [COMMAND]
Usage: fake [COMMAND]
For more information try --help
",
@ -515,8 +507,7 @@ fn bad_multicall_command_error() {
static HELLO_EXPECTED: &str = "\
error: The subcommand 'world' wasn't recognized
Usage:
<COMMAND>
Usage: <COMMAND>
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'
Usage:
<COMMAND>
Usage: <COMMAND>
For more information try help
";
@ -572,8 +562,7 @@ fn cant_have_args_with_multicall() {
#[test]
fn multicall_help_flag() {
static EXPECTED: &str = "\
Usage:
foo bar [value]
Usage: foo bar [value]
Arguments:
[value]
@ -593,8 +582,7 @@ Options:
#[test]
fn multicall_help_subcommand() {
static EXPECTED: &str = "\
Usage:
foo bar [value]
Usage: foo bar [value]
Arguments:
[value]
@ -614,8 +602,7 @@ Options:
#[test]
fn multicall_render_help() {
static EXPECTED: &str = "\
Usage:
foo bar [value]
Usage: foo bar [value]
Arguments:
[value]

View file

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

View file

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

View file

@ -105,8 +105,7 @@ fn help_short_flag_no_version() {
static EXPECTED: &str = "\
foo
Usage:
foo
Usage: foo
Options:
-h, --help Print help information
@ -120,8 +119,7 @@ fn help_long_flag_no_version() {
static EXPECTED: &str = "\
foo
Usage:
foo
Usage: foo
Options:
-h, --help Print help information
@ -135,8 +133,7 @@ fn help_short_flag_with_version() {
static EXPECTED: &str = "\
foo 3.0
Usage:
foo
Usage: foo
Options:
-h, --help Print help information
@ -151,8 +148,7 @@ fn help_long_flag_with_version() {
static EXPECTED: &str = "\
foo 3.0
Usage:
foo
Usage: foo
Options:
-h, --help Print help information
@ -167,8 +163,7 @@ fn help_short_flag_with_long_version() {
static EXPECTED: &str = "\
foo 3.0 (abcdefg)
Usage:
foo
Usage: foo
Options:
-h, --help Print help information
@ -183,8 +178,7 @@ fn help_long_flag_with_long_version() {
static EXPECTED: &str = "\
foo 3.0 (abcdefg)
Usage:
foo
Usage: foo
Options:
-h, --help Print help information
@ -199,8 +193,7 @@ fn help_short_flag_with_both() {
static EXPECTED: &str = "\
foo 3.0
Usage:
foo
Usage: foo
Options:
-h, --help Print help information
@ -215,8 +208,7 @@ fn help_long_flag_with_both() {
static EXPECTED: &str = "\
foo 3.0
Usage:
foo
Usage: foo
Options:
-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
Usage:
clap --req-str <REQ_STR>
clap <COMMAND>
Usage: clap --req-str <REQ_STR>
clap <COMMAND>
For more information try --help
"#;
@ -232,8 +231,7 @@ For more information try --help
#[test]
fn derive_order_next_order() {
static HELP: &str = "\
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
--flag-b first flag
@ -287,8 +285,7 @@ Options:
#[test]
fn derive_order_next_order_flatten() {
static HELP: &str = "\
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
--flag-b first flag
@ -342,8 +339,7 @@ Options:
#[test]
fn derive_order_no_next_order() {
static HELP: &str = "\
Usage:
test [OPTIONS]
Usage: test [OPTIONS]
Options:
--flag-a first flag
@ -398,8 +394,7 @@ fn derive_possible_value_help() {
static HELP: &str = "\
Application help
Usage:
clap <ARG>
Usage: clap <ARG>
Arguments:
<ARG>

View file

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

View file

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

View file

@ -3,8 +3,7 @@ args = []
status.code = 2
stdout = ""
stderr = """
Usage:
stdio-fixture[EXE] [OPTIONS] [COMMAND]
Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
Commands:
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`
Usage:
stdio-fixture[EXE] [OPTIONS] [COMMAND]
Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
For more information try --help
"""

View file

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

View file

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

View file

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