Skip to content

Commit

Permalink
fix(help): Don't style newlines
Browse files Browse the repository at this point in the history
Windows will style all blank space until the end of line (sometimes).

Fixes clap-rs#4431
  • Loading branch information
epage committed Mar 16, 2023
1 parent 1421bcb commit 24c1c70
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/output/help_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
.get_subcommand_help_heading()
.unwrap_or(&default_help_heading),
);
self.header(":\n");
self.header(":");
self.none("\n");

self.write_subcommands(self.cmd);
}
Expand All @@ -376,7 +377,8 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
}
first = false;
// Write positional args if any
self.header("Arguments:\n");
self.header("Arguments:");
self.none("\n");
self.write_args(&pos, "Arguments", positional_sort_key);
}

Expand All @@ -385,7 +387,8 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
self.none("\n\n");
}
first = false;
self.header("Options:\n");
self.header("Options:");
self.none("\n");
self.write_args(&non_pos, "Options", option_sort_key);
}
if !custom_headings.is_empty() {
Expand All @@ -407,7 +410,9 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
self.none("\n\n");
}
first = false;
self.header(format!("{heading}:\n"));
self.header(heading);
self.header(":");
self.none("\n");
self.write_args(&args, heading, option_sort_key);
}
}
Expand Down

0 comments on commit 24c1c70

Please sign in to comment.