1 use std::{env, fs::create_dir_all, path::Path};
3 use clap::{ArgEnum, IntoApp};
4 use clap_generate::{generate_to, Shell};
6 include!("src/opts.rs");
9 println!("cargo:rerun-if-env-changed=GEN_COMPLETIONS");
11 if env::var_os("GEN_COMPLETIONS") != Some("1".into()) {
15 let out = &Path::new(&env::var_os("OUT_DIR").unwrap()).join("completions");
16 create_dir_all(out).unwrap();
17 let app = &mut Opts::into_app();
19 for shell in Shell::value_variants() {
20 generate_to(*shell, app, "ouch", out).unwrap();