From 716444c7b108c519f91cbd8fd50c560ff98c00bd Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 19 Feb 2022 11:34:04 +0100 Subject: [PATCH 1/2] user docs: move the examples after the options --- src/bin/uudoc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/uudoc.rs b/src/bin/uudoc.rs index d89a043d1..4020b2787 100644 --- a/src/bin/uudoc.rs +++ b/src/bin/uudoc.rs @@ -72,8 +72,8 @@ fn write_markdown( write_version(&mut w, app)?; write_usage(&mut w, app, name)?; write_description(&mut w, app)?; - write_examples(&mut w, name, tldr_zip)?; - write_options(&mut w, app) + write_options(&mut w, app)?; + write_examples(&mut w, name, tldr_zip) } fn write_version(w: &mut impl Write, app: &App) -> io::Result<()> { @@ -203,5 +203,5 @@ fn write_options(w: &mut impl Write, app: &App) -> io::Result<()> { writeln!(w, "")?; writeln!(w, "
\n\n{}\n\n
", arg.get_help().unwrap_or_default())?; } - writeln!(w, "") + writeln!(w, "\n") } From be0b77e7a73dded31deb35f48a8027285ec77cba Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 19 Feb 2022 12:47:29 +0100 Subject: [PATCH 2/2] when help item has an \n, translate it to a
example: https://uutils.github.io/coreutils-docs/user/utils/ls.html / classify --- src/bin/uudoc.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bin/uudoc.rs b/src/bin/uudoc.rs index 4020b2787..33e5bf607 100644 --- a/src/bin/uudoc.rs +++ b/src/bin/uudoc.rs @@ -201,7 +201,11 @@ fn write_options(w: &mut impl Write, app: &App) -> io::Result<()> { write!(w, "")?; } writeln!(w, "")?; - writeln!(w, "
\n\n{}\n\n
", arg.get_help().unwrap_or_default())?; + writeln!( + w, + "
\n\n{}\n\n
", + arg.get_help().unwrap_or_default().replace("\n", "
") + )?; } writeln!(w, "\n") }