generate a man page as part of the build

This commit is contained in:
Alexander Kjäll
2023-01-27 20:08:11 +01:00
committed by andy.boot
parent 810cc8b604
commit fdbed14334
4 changed files with 111 additions and 0 deletions
+9
View File
@@ -1,5 +1,8 @@
use clap_complete::{generate_to, shells::*};
use std::io::Error;
use std::path::Path;
use std::fs::File;
use clap_mangen::Man;
include!("src/cli.rs");
@@ -14,5 +17,11 @@ fn main() -> Result<(), Error> {
generate_to(PowerShell, &mut cmd, app_name, outdir)?;
generate_to(Elvish, &mut cmd, app_name, outdir)?;
let file = Path::new("man-page").join("dust.1");
std::fs::create_dir("man-page");
let mut file = File::create(&file)?;
Man::new(cmd).render(&mut file)?;
Ok(())
}