mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
docs: add version
This commit is contained in:
parent
a903fee569
commit
5ff4796b12
2 changed files with 19 additions and 3 deletions
8
docs/theme/head.hbs
vendored
8
docs/theme/head.hbs
vendored
|
@ -2,4 +2,12 @@
|
|||
dd {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
main {
|
||||
position: relative;
|
||||
}
|
||||
.version {
|
||||
position: absolute;
|
||||
top: 1em;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
|
@ -14,8 +14,6 @@ use std::io::Write;
|
|||
include!(concat!(env!("OUT_DIR"), "/uutils_map.rs"));
|
||||
|
||||
fn main() {
|
||||
uucore::panic::mute_sigpipe_panic();
|
||||
|
||||
let utils = util_map::<Box<dyn Iterator<Item = OsString>>>();
|
||||
|
||||
for (name, (_, app)) in utils {
|
||||
|
@ -23,18 +21,28 @@ fn main() {
|
|||
if let Ok(f) = File::create(&p) {
|
||||
write_markdown(f, &mut app());
|
||||
println!("Wrote to '{}'", p);
|
||||
} else {
|
||||
println!("Error writing to {}", p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn write_markdown(mut w: impl Write, app: &mut App) {
|
||||
write_version(&mut w, app);
|
||||
write_summary(&mut w, app);
|
||||
write_options(&mut w, app);
|
||||
}
|
||||
|
||||
fn write_version(w: &mut impl Write, app: &App) {
|
||||
let _ = writeln!(
|
||||
w,
|
||||
"<div class=\"version\">version: {}</div>",
|
||||
app.render_version().split_once(' ').unwrap().1
|
||||
);
|
||||
}
|
||||
|
||||
fn write_summary(w: &mut impl Write, app: &App) {
|
||||
if let Some(about) = app.get_long_about().or_else(|| app.get_about()) {
|
||||
let _ = writeln!(w, "<h2>Summary</h2>");
|
||||
let _ = writeln!(w, "{}", about);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue