-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.rs
28 lines (23 loc) · 825 Bytes
/
build.rs
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
use std::{env, fs};
use clap::CommandFactory;
include!("src/args.rs");
fn main() {
// get target directory
let target_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("target");
// generate manual
let manual_dir = target_dir.join("manual");
fs::create_dir_all(&manual_dir).unwrap();
println!(
"man generated at {:?}",
clap_mangen::generate_to(Args::command(), manual_dir).unwrap()
);
// generate completions
let completion_dir = target_dir.join("completion");
fs::create_dir_all(&completion_dir).unwrap();
for &shell in clap_complete::Shell::value_variants() {
println!(
"completions generated at {:?}",
clap_complete::generate_to(shell, &mut Args::command(), "tw", &completion_dir).unwrap()
);
}
}