Files
hyperfine/build.rs
T

20 lines
579 B
Rust
Raw Normal View History

2020-05-21 22:37:10 +10:00
use std::fs;
use clap::Shell;
2021-08-24 21:24:34 +02:00
include!("src/app.rs");
2020-05-21 22:37:10 +10:00
fn main() {
2021-06-11 17:44:11 -04:00
let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR"));
2020-05-21 22:37:10 +10:00
let outdir = match var {
None => return,
Some(outdir) => outdir,
};
fs::create_dir_all(&outdir).unwrap();
let mut app = build_app();
app.gen_completions("hyperfine", Shell::Bash, &outdir);
app.gen_completions("hyperfine", Shell::Fish, &outdir);
app.gen_completions("hyperfine", Shell::Zsh, &outdir);
app.gen_completions("hyperfine", Shell::PowerShell, &outdir);
}