From 2bb2c69269a494f38d1a206f6748fdf6cc8cc152 Mon Sep 17 00:00:00 2001 From: Arthur Beck Date: Fri, 2 May 2025 17:30:14 -0500 Subject: [PATCH] Implement man page generation --- build.rs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/build.rs b/build.rs index 0e00e07..4b9ff10 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,6 @@ +#![allow(unused_imports)] use roff::{Roff, bold, italic, roman}; +use std::{env, path::PathBuf}; fn main() { let page = Roff::new() @@ -6,27 +8,23 @@ fn main() { .control("SH", ["NAME"]) .text([roman("sesh - Semantic Shell")]) .control("SH", ["SYNOPSIS"]) - .text([ - bold("sesh"), - roman(" [options]"), - ]) + .text([bold("sesh"), roman(" [options]")]) .control("SH", ["DESCRIPTION"]) .text([ bold("sesh"), 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(); - print!("{}", page); + std::fs::write( + PathBuf::from(env::var_os("OUT_DIR").unwrap()) + .parent() + .unwrap() + .parent() + .unwrap() + .parent() + .unwrap() + .join("sesh.1"), + page, + ) + .unwrap(); }