/ thirdparty / hyperfine / build.rs
build.rs
 1  use std::fs;
 2  
 3  use clap_complete::{generate_to, Shell};
 4  
 5  include!("src/cli.rs");
 6  
 7  fn main() {
 8      let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR"));
 9      let outdir = match var {
10          None => return,
11          Some(outdir) => outdir,
12      };
13      fs::create_dir_all(&outdir).unwrap();
14  
15      let mut command = build_command();
16      for shell in [
17          Shell::Bash,
18          Shell::Fish,
19          Shell::Zsh,
20          Shell::PowerShell,
21          Shell::Elvish,
22      ] {
23          generate_to(shell, &mut command, "hyperfine", &outdir).unwrap();
24      }
25  }