mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
docs: allow for multiline usage
This commit is contained in:
parent
1167d811d5
commit
4f7f4445cb
1 changed files with 8 additions and 1 deletions
|
@ -67,7 +67,14 @@ fn write_version(w: &mut impl Write, app: &App) -> io::Result<()> {
|
|||
|
||||
fn write_usage(w: &mut impl Write, app: &mut App, name: &str) -> io::Result<()> {
|
||||
writeln!(w, "\n```")?;
|
||||
let mut usage: String = app.render_usage().lines().nth(1).unwrap().trim().into();
|
||||
let mut usage: String = app
|
||||
.render_usage()
|
||||
.lines()
|
||||
.skip(1)
|
||||
.map(|l| l.trim())
|
||||
.filter(|l| !l.is_empty())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
usage = usage.replace(app.get_name(), name);
|
||||
writeln!(w, "{}", usage)?;
|
||||
writeln!(w, "```")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue