Skip to content
Myr

Use clap to generate shell completions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by four0000four · committed by David Peter · parent 4db0115 · Browse files · 3 files+47 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+47 added−0 removed

  • other:+47 added−0 removed

3 files+47 added−0 removed

modified:ci/before_deploy.bash+10 added
added:build.rs+31 added
1use std::fs;23use clap::Shell;45include!("src/hyperfine/app.rs");67fn main() {8 let min_version = "1.39";910 match version_check::is_min_version(min_version) {11 Some(true) => {}12 // rustc version too small or can't figure it out13 _ => {14 eprintln!("'hyperfine' requires rustc >= {}", min_version);15 std::process::exit(1);16 }17 }1819 let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or(std::env::var_os("OUT_DIR"));20 let outdir = match var {21 None => return,22 Some(outdir) => outdir,23 };24 fs::create_dir_all(&outdir).unwrap();2526 let mut app = build_app();27 app.gen_completions("hyperfine", Shell::Bash, &outdir);28 app.gen_completions("hyperfine", Shell::Fish, &outdir);29 app.gen_completions("hyperfine", Shell::Zsh, &outdir);30 app.gen_completions("hyperfine", Shell::PowerShell, &outdir);31}
modified:Cargo.toml+6 added