-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
28 lines (20 loc) · 911 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 clap_complete::generate_to;
use std::env;
use std::io::Error;
include!("src/cli.rs");
fn main() -> Result<(), Error> {
let out = match env::var_os("OUT_DIR") {
None => return Ok(()),
Some(outdir) => outdir,
};
let mut cmd = build_cli();
let path = generate_to(clap_complete::shells::Bash, &mut cmd, "imgname", &out)?;
println!("cargo:warning=completion file generated: {:?}", path);
let path = generate_to(clap_complete::shells::Fish, &mut cmd, "imgname", &out)?;
println!("cargo:warning=completion file generated: {:?}", path);
let path = generate_to(clap_complete::shells::Zsh, &mut cmd, "imgname", &out)?;
println!("cargo:warning=completion file generated: {:?}", path);
let path = generate_to(clap_complete::shells::PowerShell, &mut cmd, "imgname", &out)?;
println!("cargo:warning=completion file generated: {:?}", path);
Ok(())
}