fix(help): I think this fixes a bug?

The existing behavior is hard to explain, so this is the best I've
figured is going on.
This commit is contained in:
Ed Page 2022-09-07 16:37:27 -05:00
parent 876da97d1c
commit 56fe50eab8
2 changed files with 4 additions and 9 deletions

View file

@ -552,20 +552,16 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> {
self.none(NEXT_LINE_INDENT);
}
let trailing_indent = if next_line_help {
let spaces = if next_line_help {
TAB.len() + NEXT_LINE_INDENT.len()
} else if let Some(true) = arg.map(|a| a.is_positional()) {
longest + TAB_WIDTH * 2
} else {
longest + TAB_WIDTH * 3
};
let trailing_indent = spaces; // Don't indent any further than the first line is indented
let trailing_indent = self.get_spaces(trailing_indent);
let spaces = if next_line_help {
TAB.len() + NEXT_LINE_INDENT.len()
} else {
longest + TAB_WIDTH * 3
};
let mut help = about.clone();
help.replace_newline();
if !spec_vals.is_empty() {
@ -590,7 +586,6 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> {
help.indent("", &trailing_indent);
let help_is_empty = help.is_empty();
self.writer.extend(help.into_iter());
if let Some(arg) = arg {
const DASH_SPACE: usize = "- ".len();
const COLON_SPACE: usize = ": ".len();

View file

@ -755,8 +755,8 @@ Arguments:
symbols.
l, long Copy-friendly, 14
characters, contains symbols.
m, med, medium Copy-friendly, 8
characters, contains symbols.
m, med, medium Copy-friendly, 8 characters,
contains symbols.
Options:
-h, --help Print help information