Trim CLI help during generation (#1492)

This commit is contained in:
Charlie Marsh 2022-12-30 22:03:58 -05:00 committed by GitHub
parent 95f139583a
commit 248447e139
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -384,7 +384,6 @@ Options:
Print help information
-V, --version
Print version information
```
<!-- End auto-generated cli help. -->

View file

@ -16,9 +16,13 @@ pub struct Cli {
pub(crate) dry_run: bool,
}
fn trim_lines(s: &str) -> String {
s.lines().map(str::trim_end).collect::<Vec<_>>().join("\n")
}
pub fn main(cli: &Cli) -> Result<()> {
let mut cmd = MainCli::command();
let output = cmd.render_help().to_string();
let output = trim_lines(cmd.render_help().to_string().trim());
if cli.dry_run {
print!("{output}");