Skip to content

Commit

Permalink
fix(help): Be consistent in long/short help
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 9, 2023
1 parent 66d2bcb commit 9e5f93d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions clap_builder/src/output/help_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,9 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
cmd: subcommand,
styles: self.styles,
usage: self.usage,
next_line_help: false,
next_line_help: self.next_line_help,
term_w: self.term_w,
use_long: false,
use_long: self.use_long,
};
let args = subcommand
.get_arguments()
Expand Down
20 changes: 14 additions & 6 deletions tests/builder/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3028,11 +3028,15 @@ Options:
Print help (see a summary with '-h')
parent test:
--child <child> foo
-h, --help Print help (see more with '--help')
--child <child>
bar
-h, --help
Print help (see a summary with '-h')
parent help:
[COMMAND]... Print help for the subcommand(s)
[COMMAND]...
Print help for the subcommand(s)
";
let cmd = Command::new("parent")
.flatten_help(true)
Expand Down Expand Up @@ -3066,11 +3070,15 @@ Options:
Print help (see a summary with '-h')
parent test:
--child <child> foo
-h, --help Print help (see more with '--help')
--child <child>
bar
-h, --help
Print help (see a summary with '-h')
parent help:
[COMMAND]... Print help for the subcommand(s)
[COMMAND]...
Print help for the subcommand(s)
";
let cmd = Command::new("parent")
.flatten_help(true)
Expand Down

0 comments on commit 9e5f93d

Please sign in to comment.