Skip to content

Commit 360bb3b

Browse files
committed
fix(help): Properly wrap subcommand about
Fixes #5607
1 parent 58b5bd8 commit 360bb3b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

clap_builder/src/output/help_template.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
650650

651651
let spaces = if next_line_help {
652652
TAB.len() + NEXT_LINE_INDENT.len()
653-
} else if let Some(true) = arg.map(|a| a.is_positional()) {
653+
} else if arg.map(|a| a.is_positional()).unwrap_or(true) {
654654
longest + TAB_WIDTH * 2
655655
} else {
656656
longest + TAB_WIDTH * 2 + 4 // See `fn short` for the 4

tests/builder/help.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,8 @@ Usage: test [OPTIONS] [COMMAND]
577577
578578
Commands:
579579
sub1 One two three four five six seven eight nine ten eleven
580-
twelve thirteen fourteen fifteen
581-
help Print this message or the help of the given
582-
subcommand(s)
580+
twelve thirteen fourteen fifteen
581+
help Print this message or the help of the given subcommand(s)
583582
584583
Options:
585584
-a, --all Also do versioning for private crates (will
@@ -635,9 +634,8 @@ Usage: test [OPTIONS] [COMMAND]
635634
636635
Commands:
637636
sub1 One two three four five six seven eight nine ten eleven
638-
twelve thirteen fourteen fifteen
639-
help Print this message or the help of the given
640-
subcommand(s)
637+
twelve thirteen fourteen fifteen
638+
help Print this message or the help of the given subcommand(s)
641639
642640
Options:
643641
-a, --all Also do versioning for private crates (will

0 commit comments

Comments
 (0)