mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 15:48:22 +00:00
Trim CLI help during generation (#1492)
This commit is contained in:
parent
95f139583a
commit
248447e139
2 changed files with 5 additions and 2 deletions
|
@ -384,7 +384,6 @@ Options:
|
|||
Print help information
|
||||
-V, --version
|
||||
Print version information
|
||||
|
||||
```
|
||||
<!-- End auto-generated cli help. -->
|
||||
|
||||
|
|
|
@ -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}");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue