23 lines
537 B
Rust
23 lines
537 B
Rust
|
use clap::{CommandFactory, ValueEnum};
|
||
|
use clap_complete::{generate_to, Shell};
|
||
|
use std::{env, io::Error};
|
||
|
|
||
|
include!("src/cli/mod.rs");
|
||
|
|
||
|
fn main() -> Result<(), Error> {
|
||
|
let outdir = match env::var_os("OUT_DIR") {
|
||
|
None => return Ok(()),
|
||
|
Some(outdir) => outdir,
|
||
|
};
|
||
|
|
||
|
let mut cmd = ahab::Ahab::command();
|
||
|
|
||
|
for shell in Shell::value_variants() {
|
||
|
let path = generate_to(*shell, &mut cmd, "ahab", &outdir)?;
|
||
|
|
||
|
println!("cargo:warning=completion file is generated: {path:?}");
|
||
|
}
|
||
|
|
||
|
Ok(())
|
||
|
}
|