mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-11-25 19:19:31 +03:00
26 lines
584 B
Rust
26 lines
584 B
Rust
use std::fs;
|
|
|
|
use clap_complete::{generate_to, Shell};
|
|
|
|
include!("src/cli.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 command = build_command();
|
|
for shell in [
|
|
Shell::Bash,
|
|
Shell::Fish,
|
|
Shell::Zsh,
|
|
Shell::PowerShell,
|
|
Shell::Elvish,
|
|
] {
|
|
generate_to(shell, &mut command, "hyperfine", &outdir).unwrap();
|
|
}
|
|
}
|