feat: compile time completion generation
Removed `completion` command in favor of compile time completion generation. This tool will only be build from source for the foreseeable future so this makes sense for now.
This commit is contained in:
22
build.rs
Normal file
22
build.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
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(())
|
||||
}
|
||||
Reference in New Issue
Block a user