Implement man page generation

This commit is contained in:
Arthur Beck 2025-05-02 17:30:14 -05:00
parent b7c8dc3fba
commit 2bb2c69269
Signed by: ArthurB
GPG key ID: CA200B389F0F6BC9

View file

@ -1,4 +1,6 @@
#![allow(unused_imports)]
use roff::{Roff, bold, italic, roman}; use roff::{Roff, bold, italic, roman};
use std::{env, path::PathBuf};
fn main() { fn main() {
let page = Roff::new() let page = Roff::new()
@ -6,27 +8,23 @@ fn main() {
.control("SH", ["NAME"]) .control("SH", ["NAME"])
.text([roman("sesh - Semantic Shell")]) .text([roman("sesh - Semantic Shell")])
.control("SH", ["SYNOPSIS"]) .control("SH", ["SYNOPSIS"])
.text([ .text([bold("sesh"), roman(" [options]")])
bold("sesh"),
roman(" [options]"),
])
.control("SH", ["DESCRIPTION"]) .control("SH", ["DESCRIPTION"])
.text([ .text([
bold("sesh"), bold("sesh"),
roman("is a shell designed to be as semantic to use as possible"), roman("is a shell designed to be as semantic to use as possible"),
]) ])
.control("SH", ["OPTIONS"])
.control("TP", [])
.text([
bold("-n"),
roman(", "),
bold("--bits"),
roman("="),
italic("BITS"),
])
.text([roman(
"Set the number of bits to modify. Default is one bit.",
)])
.render(); .render();
print!("{}", page); std::fs::write(
PathBuf::from(env::var_os("OUT_DIR").unwrap())
.parent()
.unwrap()
.parent()
.unwrap()
.parent()
.unwrap()
.join("sesh.1"),
page,
)
.unwrap();
} }