Fix completion build.rs
This commit is contained in:
16
build.rs
16
build.rs
@@ -3,6 +3,7 @@ extern crate clap;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
|
||||
use clap::Shell;
|
||||
@@ -12,12 +13,15 @@ use clap::Shell;
|
||||
mod app;
|
||||
|
||||
fn main() {
|
||||
fs::create_dir_all(env!("OUT_DIR")).unwrap();
|
||||
let outdir = match env::var_os("OUT_DIR") {
|
||||
None => return,
|
||||
Some(outdir) => outdir,
|
||||
};
|
||||
fs::create_dir_all(&outdir).unwrap();
|
||||
|
||||
let mut app = app::app_short();
|
||||
app.gen_completions("rg", Shell::Bash, env!("OUT_DIR"));
|
||||
app.gen_completions("rg", Shell::Fish, env!("OUT_DIR"));
|
||||
// Zsh seems to fail with a panic.
|
||||
// app.gen_completions("rg", Shell::Zsh, env!("OUT_DIR"));
|
||||
app.gen_completions("rg", Shell::PowerShell, env!("OUT_DIR"));
|
||||
app.gen_completions("rg", Shell::Bash, &outdir);
|
||||
app.gen_completions("rg", Shell::Fish, &outdir);
|
||||
app.gen_completions("rg", Shell::Zsh, &outdir);
|
||||
app.gen_completions("rg", Shell::PowerShell, &outdir);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user