only generate completions if GEN_COMPLETIONS=1

This commit is contained in:
figsoda 2021-02-17 18:48:03 -05:00
parent 7ca70aa895
commit 2c0289d64a

View file

@ -6,6 +6,12 @@ use std::{env, fs::create_dir_all, path::Path};
include!("src/cli.rs");
fn main() {
println!("cargo:rerun-if-env-changed=GEN_COMPLETIONS");
if env::var_os("GEN_COMPLETIONS") != Some("1".into()) {
return;
}
let out = &Path::new(&env::var_os("OUT_DIR").unwrap()).join("completions");
create_dir_all(out).unwrap();
let app = &mut Opts::into_app();