chore: generalize build.sh
This commit is contained in:
10
build.rs
10
build.rs
@@ -5,15 +5,17 @@ use std::{env, io::Error};
|
|||||||
include!("src/cli/mod.rs");
|
include!("src/cli/mod.rs");
|
||||||
|
|
||||||
fn main() -> Result<(), Error> {
|
fn main() -> Result<(), Error> {
|
||||||
let outdir = match env::var_os("OUT_DIR") {
|
let outdir = env::var_os("SHELL_COMPLETIONS_DIR")
|
||||||
None => return Ok(()),
|
.or_else(|| env::var_os("OUT_DIR"));
|
||||||
Some(outdir) => outdir,
|
|
||||||
|
let Some(outdir) = outdir else {
|
||||||
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut cmd = ahab::Ahab::command();
|
let mut cmd = ahab::Ahab::command();
|
||||||
|
|
||||||
for shell in Shell::value_variants() {
|
for shell in Shell::value_variants() {
|
||||||
let path = generate_to(*shell, &mut cmd, "ahab", &outdir)?;
|
let path = generate_to(*shell, &mut cmd, env!("CARGO_PKG_NAME"), &outdir)?;
|
||||||
|
|
||||||
println!("cargo:warning=completion file is generated: {path:?}");
|
println!("cargo:warning=completion file is generated: {path:?}");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user