hyperfine/build.rs
2022-02-03 21:07:15 +01:00

26 lines
572 B
Rust

use std::fs;
use clap_complete::{generate_to, Shell};
include!("src/app.rs");
fn main() {
let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR"));
let outdir = match var {
None => return,
Some(outdir) => outdir,
};
fs::create_dir_all(&outdir).unwrap();
let mut app = build_app();
for shell in [
Shell::Bash,
Shell::Fish,
Shell::Zsh,
Shell::PowerShell,
Shell::Elvish,
] {
generate_to(shell, &mut app, "hyperfine", &outdir).unwrap();
}
}