mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-08-17 09:50:37 +03:00
26 lines
572 B
Rust
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();
|
|
}
|
|
}
|