-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.rs
More file actions
33 lines (26 loc) · 732 Bytes
/
build.rs
File metadata and controls
33 lines (26 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use clap::CommandFactory;
#[path = "src/cli.rs"]
mod cli;
fn man_gen() -> std::io::Result<()> {
let out_dir = std::path::PathBuf::from(
#[allow(clippy::unnecessary_lazy_evaluations)]
std::env::var_os("OUT_DIR").ok_or_else(|| std::io::ErrorKind::NotFound)?,
);
let cmd = cli::Cli::command();
let man = clap_mangen::Man::new(cmd);
let mut buffer: Vec<u8> = Default::default();
man.render(&mut buffer)?;
std::fs::write(out_dir.join("teres.1"), buffer)?;
Ok(())
}
#[cfg(unix)]
fn main() -> std::io::Result<()> {
man_gen()
}
#[cfg(windows)]
fn main() -> std::io::Result<()> {
let res = winres::WindowsResource::new();
res.compile().unwrap();
man_gen();
Ok(())
}