Ghee/build.rs

29 lines
727 B
Rust
Raw Normal View History

2023-08-03 03:57:36 +02:00
use clap::{CommandFactory, ValueEnum};
use clap_complete::generate_to;
use clap_complete::Shell;
use std::env;
use std::io::Error;
include!("src/cli.rs");
fn main() -> Result<(), Error> {
let outdir = match env::var_os("OUT_DIR") {
None => return Ok(()),
Some(outdir) => outdir,
};
let mut cmd = Cli::command();
for shell in Shell::value_variants() {
2023-08-09 08:46:18 +02:00
generate_to(
2023-08-03 03:57:36 +02:00
*shell, &mut cmd, // We need to specify what generator to use
"mtr", // We need to specify the bin name manually
&outdir, // We need to specify where to write to
)?;
// println!("cargo:warning=completion file is generated: {path:?}");
2023-08-03 03:57:36 +02:00
}
Ok(())
}