Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(help): Shorten --help short help to shorten short help #4408

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions clap_complete/tests/snapshots/sub_subcommands.elvish
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ set edit:completion:arg-completer[my-app] = {|@words|
}
&'my-app;some_cmd;sub_cmd'= {
cand --config 'the other case to test'
cand -h 'Print help information (use `--help` for more detail)'
cand --help 'Print help information (use `--help` for more detail)'
cand -h 'Print help (''--help'' for more)'
cand --help 'Print help (''--help'' for more)'
cand -V 'Print version information'
cand --version 'Print version information'
}
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/sub_subcommands.fish
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "sub_cmd" -d 'sub-subcommand'
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -l config -d 'the other case to test' -r -f -a "{Lest quotes\, aren\'t escaped. help\,with\,comma,Second to trigger display of options }"
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -s h -l help -d 'Print help information (use `--help` for more detail)'
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -s h -l help -d 'Print help (\'--help\' for more)'
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -s V -l version -d 'Print version information'
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "sub_cmd" -d 'sub-subcommand'
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
Expand Down
4 changes: 2 additions & 2 deletions clap_complete/tests/snapshots/sub_subcommands.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
}
'my-app;some_cmd;sub_cmd' {
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'the other case to test')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information (use `--help` for more detail)')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information (use `--help` for more detail)')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (''--help'' for more)')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (''--help'' for more)')
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Print version information')
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version information')
break
Expand Down
4 changes: 2 additions & 2 deletions clap_complete/tests/snapshots/sub_subcommands.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ _arguments "${_arguments_options[@]}" \
_arguments "${_arguments_options[@]}" \
'--config=[the other case to test]: :((Lest\ quotes,\ aren'\''t\ escaped.\:"help,with,comma"
Second\ to\ trigger\ display\ of\ options\:""))' \
'-h[Print help information (use `--help` for more detail)]' \
'--help[Print help information (use `--help` for more detail)]' \
'-h[Print help ('\''--help'\'' for more)]' \
'--help[Print help ('\''--help'\'' for more)]' \
'-V[Print version information]' \
'--version[Print version information]' \
&& ret=0
Expand Down
2 changes: 1 addition & 1 deletion clap_mangen/tests/snapshots/possible_values.bash.roff
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ slow: use the slow method
.RE
.TP
/fB/-h/fR, /fB/-/-help/fR
Print help information (use `/-h` for a summary)
Print help information (use /*(Aq/-h/*(Aq for a summary)
.TP
[/fIpositional_choice/fR]
Pick the Position you want the command to run in
Expand Down
2 changes: 1 addition & 1 deletion clap_mangen/tests/snapshots/value_env.bash.roff
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ May also be specified with the /fBCONFIG_FILE/fR environment variable.
.RE
.TP
/fB/-h/fR, /fB/-/-help/fR
Print help information (use `/-h` for a summary)
Print help information (use /*(Aq/-h/*(Aq for a summary)
4 changes: 2 additions & 2 deletions examples/tutorial_builder/04_01_enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Arguments:

Options:
-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand All @@ -28,7 +28,7 @@ Arguments:
<MODE> What mode to run the program in [possible values: fast, slow]

Options:
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information

$ 04_01_enum fast
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorial_derive/04_01_enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Arguments:

Options:
-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand All @@ -28,7 +28,7 @@ Arguments:
<MODE> What mode to run the program in [possible values: fast, slow]

Options:
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information

$ 04_01_enum_derive fast
Expand Down
6 changes: 4 additions & 2 deletions src/builder/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4241,8 +4241,10 @@ impl Command {
.action(ArgAction::Help);
if self.long_help_exists {
arg = arg
.help("Print help information (use `--help` for more detail)")
.long_help("Print help information (use `-h` for a summary)");
// keep this message brief, for applications that want to
// use the two-column short help format
.help("Print help ('--help' for more)")
.long_help("Print help information (use '-h' for a summary)");
} else {
arg = arg.help("Print help information");
}
Expand Down
20 changes: 10 additions & 10 deletions tests/builder/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ tests clap library
Usage: clap-test

Options:
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information

some text that comes after the help
Expand All @@ -279,7 +279,7 @@ Usage: clap-test

Options:
-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand Down Expand Up @@ -470,7 +470,7 @@ Options:
- second: short help

-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)
";
let cmd = Command::new("test")
.term_width(67)
Expand Down Expand Up @@ -648,7 +648,7 @@ Options:
A coffeehouse, coffee shop, or café.

-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand Down Expand Up @@ -990,7 +990,7 @@ Arguments:

Options:
-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand Down Expand Up @@ -1689,7 +1689,7 @@ does stuff
Usage: test [OPTIONS] --song <song> --song-volume <volume>

Options:
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information

OVERRIDE SPECIAL:
Expand Down Expand Up @@ -1745,7 +1745,7 @@ Usage: ctest foo

Options:
-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand All @@ -1768,7 +1768,7 @@ About foo
Usage: ctest foo

Options:
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information
";

Expand All @@ -1793,7 +1793,7 @@ Arguments:

Options:
-f
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
";

let cmd = Command::new("demo")
Expand Down Expand Up @@ -1948,7 +1948,7 @@ Options:
and on, so I'll stop now.

-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)
";

let cmd = Command::new("prog").arg(
Expand Down
8 changes: 4 additions & 4 deletions tests/builder/hidden_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Usage: test [OPTIONS]

Options:
-v, --visible This text should be visible
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information
";

Expand Down Expand Up @@ -80,7 +80,7 @@ Options:
This text should be visible

-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand Down Expand Up @@ -117,7 +117,7 @@ Options:
This text should be visible

-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand Down Expand Up @@ -154,7 +154,7 @@ Usage: test [OPTIONS]
Options:
-c, --config Some help text describing the --config arg
-v, --visible This text should be visible
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information
";

Expand Down
2 changes: 1 addition & 1 deletion tests/derive/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Arguments:

Options:
-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)
";

/// Application help
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/arg_required_else_help_stderr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Commands:

Options:
--verbose log
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information
"""
2 changes: 1 addition & 1 deletion tests/ui/h_flag_stdout.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Commands:

Options:
--verbose log
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help ('--help' for more)
-V, --version Print version information
"""
stderr = ""
2 changes: 1 addition & 1 deletion tests/ui/help_cmd_stdout.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Options:
more log

-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/help_flag_stdout.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Options:
more log

-h, --help
Print help information (use `-h` for a summary)
Print help information (use '-h' for a summary)

-V, --version
Print version information
Expand Down