Skip to content

Commit

Permalink
fix(help): Properly wrap subcommand about
Browse files Browse the repository at this point in the history
Fixes #5607
  • Loading branch information
epage committed Jul 31, 2024
1 parent 58b5bd8 commit 360bb3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion clap_builder/src/output/help_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {

let spaces = if next_line_help {
TAB.len() + NEXT_LINE_INDENT.len()
} else if let Some(true) = arg.map(|a| a.is_positional()) {
} else if arg.map(|a| a.is_positional()).unwrap_or(true) {
longest + TAB_WIDTH * 2
} else {
longest + TAB_WIDTH * 2 + 4 // See `fn short` for the 4
Expand Down
10 changes: 4 additions & 6 deletions tests/builder/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,8 @@ Usage: test [OPTIONS] [COMMAND]
Commands:
sub1 One two three four five six seven eight nine ten eleven
twelve thirteen fourteen fifteen
help Print this message or the help of the given
subcommand(s)
twelve thirteen fourteen fifteen
help Print this message or the help of the given subcommand(s)
Options:
-a, --all Also do versioning for private crates (will
Expand Down Expand Up @@ -635,9 +634,8 @@ Usage: test [OPTIONS] [COMMAND]
Commands:
sub1 One two three four five six seven eight nine ten eleven
twelve thirteen fourteen fifteen
help Print this message or the help of the given
subcommand(s)
twelve thirteen fourteen fifteen
help Print this message or the help of the given subcommand(s)
Options:
-a, --all Also do versioning for private crates (will
Expand Down

0 comments on commit 360bb3b

Please sign in to comment.