mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
Merge pull request #3196 from epage/help
fix(help): Don't infer long help from subcommands
This commit is contained in:
commit
a61a63ac88
2 changed files with 6 additions and 8 deletions
|
@ -1072,11 +1072,12 @@ impl<'help, 'app> Parser<'help, 'app> {
|
|||
|| v.is_set(ArgSettings::HiddenShortHelp)
|
||||
};
|
||||
|
||||
// Subcommands aren't checked because we prefer short help for them, deferring to
|
||||
// `cmd subcmd --help` for more.
|
||||
self.app.long_about.is_some()
|
||||
|| self.app.before_long_help.is_some()
|
||||
|| self.app.after_long_help.is_some()
|
||||
|| self.app.args.args().any(should_long)
|
||||
|| self.app.subcommands.iter().any(|s| s.long_about.is_some())
|
||||
}
|
||||
|
||||
fn parse_long_arg(
|
||||
|
|
|
@ -597,14 +597,11 @@ USAGE:
|
|||
about-in-subcommands-list [SUBCOMMAND]
|
||||
|
||||
OPTIONS:
|
||||
-h, --help
|
||||
Print help information
|
||||
-h, --help Print help information
|
||||
|
||||
SUBCOMMANDS:
|
||||
help
|
||||
Print this message or the help of the given subcommand(s)
|
||||
sub
|
||||
short about sub
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
sub short about sub
|
||||
";
|
||||
|
||||
fn setup() -> App<'static> {
|
||||
|
@ -2281,7 +2278,7 @@ fn option_usage_order() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn about_in_subcommands_list() {
|
||||
fn prefer_about_over_long_about_in_subcommands_list() {
|
||||
let app = App::new("about-in-subcommands-list").subcommand(
|
||||
App::new("sub")
|
||||
.long_about("long about sub")
|
||||
|
|
Loading…
Reference in a new issue