1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-01-31 10:11:07 +00:00

Completely disable generation of shell completion files

This commit is contained in:
sharkdp 2019-01-26 16:29:21 +01:00 committed by David Peter
parent 724a5fac99
commit a500629359

View File

@ -1,26 +1,31 @@
#[macro_use] // TODO: Re-enable generation of shell completion files (below) when clap 3 is out.
extern crate clap; // For more details, see https://github.com/sharkdp/bat/issues/372
use clap::Shell; fn main() {}
use std::fs;
include!("src/clap_app.rs"); // #[macro_use]
// extern crate clap;
const BIN_NAME: &str = "bat"; // use clap::Shell;
// use std::fs;
fn main() { // include!("src/clap_app.rs");
let outdir = std::env::var_os("SHELL_COMPLETIONS_DIR").or(std::env::var_os("OUT_DIR"));
let outdir = match outdir { // const BIN_NAME: &str = "bat";
None => return,
Some(outdir) => outdir,
};
fs::create_dir_all(&outdir).unwrap(); // fn main() {
// let outdir = std::env::var_os("SHELL_COMPLETIONS_DIR").or(std::env::var_os("OUT_DIR"));
let mut app = build_app(true); // let outdir = match outdir {
app.gen_completions(BIN_NAME, Shell::Bash, &outdir); // None => return,
app.gen_completions(BIN_NAME, Shell::Fish, &outdir); // Some(outdir) => outdir,
app.gen_completions(BIN_NAME, Shell::Zsh, &outdir); // };
app.gen_completions(BIN_NAME, Shell::PowerShell, &outdir);
} // fs::create_dir_all(&outdir).unwrap();
// let mut app = build_app(true);
// app.gen_completions(BIN_NAME, Shell::Bash, &outdir);
// app.gen_completions(BIN_NAME, Shell::Fish, &outdir);
// app.gen_completions(BIN_NAME, Shell::Zsh, &outdir);
// app.gen_completions(BIN_NAME, Shell::PowerShell, &outdir);
// }