mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
docs: allow for multiline usage
This commit is contained in:
+8
-1
@@ -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, "```")
|
||||
|
||||
Reference in New Issue
Block a user