1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 13:07:46 +00:00

uudoc: update to clap 4

This commit is contained in:
Terts Diepraam 2022-10-14 16:47:39 +02:00
parent 23ef35e184
commit cbc8427419

View file

@ -109,7 +109,7 @@ fn main() -> io::Result<()> {
struct MDWriter<'a, 'b> {
w: Box<dyn Write>,
command: Command<'a>,
command: Command,
name: &'a str,
tldr_zip: &'b mut Option<ZipArchive<File>>,
utils_per_platform: &'b HashMap<&'b str, Vec<String>>,
@ -167,13 +167,16 @@ impl<'a, 'b> MDWriter<'a, 'b> {
let mut usage: String = self
.command
.render_usage()
.to_string()
.lines()
.skip(1)
.map(|l| l.trim())
.filter(|l| !l.is_empty())
.collect::<Vec<_>>()
.join("\n");
usage = usage.replace(uucore::execution_phrase(), self.name);
usage = usage
.to_string()
.replace(uucore::execution_phrase(), self.name);
writeln!(self.w, "{}", usage)?;
writeln!(self.w, "```")
}
@ -282,7 +285,10 @@ impl<'a, 'b> MDWriter<'a, 'b> {
writeln!(
self.w,
"<dd>\n\n{}\n\n</dd>",
arg.get_help().unwrap_or_default().replace('\n', "<br />")
arg.get_help()
.unwrap_or_default()
.to_string()
.replace('\n', "<br />")
)?;
}
writeln!(self.w, "</dl>\n")