-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
38 lines (33 loc) · 1.01 KB
/
build.rs
File metadata and controls
38 lines (33 loc) · 1.01 KB
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
34
35
36
37
38
mod cli {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/cli/args.rs"));
}
fn main() -> std::io::Result<()> {
let out_dir_main =
std::path::PathBuf::from(std::env::var_os("OUT_DIR").ok_or(std::io::ErrorKind::NotFound)?);
let out_dir_man = out_dir_main.join("man");
std::fs::create_dir_all(&out_dir_man)?;
let cmd = <cli::Args as clap::CommandFactory>::command();
clap_mangen::generate_to(cmd, &out_dir_man)?;
let out_dir_comp = out_dir_main.join("comp");
std::fs::create_dir_all(&out_dir_comp)?;
let mut cmd2 = <cli::Args as clap::CommandFactory>::command();
clap_complete::generate_to(
clap_complete::Shell::Zsh,
&mut cmd2,
"postar",
&out_dir_comp,
)?;
clap_complete::generate_to(
clap_complete::Shell::Fish,
&mut cmd2,
"postar",
&out_dir_comp,
)?;
clap_complete::generate_to(
clap_complete::Shell::Bash,
&mut cmd2,
"postar",
&out_dir_comp,
)?;
Ok(())
}