Skip to content

Commit 594a771

Browse files
committed
refactor(help): Make empty tracking more consistent
1 parent 883b9f9 commit 594a771

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

clap_builder/src/output/help_template.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,11 @@ impl HelpTemplate<'_, '_> {
635635
let trailing_indent = self.get_spaces(trailing_indent);
636636

637637
let mut help = about.clone();
638+
let mut help_is_empty = help.is_empty();
638639
help.replace_newline_var();
639640

640641
if !spec_vals.is_empty() {
641-
if !help.is_empty() {
642+
if !help_is_empty {
642643
let sep = if self.use_long && arg.is_some() {
643644
"\n\n"
644645
} else {
@@ -647,6 +648,7 @@ impl HelpTemplate<'_, '_> {
647648
help.push_str(sep);
648649
}
649650
help.push_str(spec_vals);
651+
help_is_empty = help.is_empty();
650652
}
651653

652654
let avail_chars = self.term_w.saturating_sub(spaces);
@@ -658,7 +660,6 @@ impl HelpTemplate<'_, '_> {
658660
);
659661
help.wrap(avail_chars);
660662
help.indent("", &trailing_indent);
661-
let help_is_empty = help.is_empty();
662663
self.writer.push_styled(&help);
663664

664665
if let Some(arg) = arg {

0 commit comments

Comments
 (0)