fn main() {
#[cfg(feature = "cli")]
cli::main();
}
#[cfg(feature = "cli")]
mod cli {
include!("src/cli.rs");
use std::{fs, env, path::Path};
use tc_cli::structopt::clap::Shell;
use build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
pub fn main() {
build_shell_completion();
generate_cargo_keys();
rerun_if_git_head_changed();
}
fn build_shell_completion() {
for shell in &[Shell::Bash, Shell::Fish, Shell::Zsh, Shell::Elvish, Shell::PowerShell] {
build_completion(shell);
}
}
fn build_completion(shell: &Shell) {
let outdir = match env::var_os("OUT_DIR") {
None => return,
Some(dir) => dir,
};
let path = Path::new(&outdir)
.parent().unwrap()
.parent().unwrap()
.parent().unwrap()
.join("completion-scripts");
fs::create_dir(&path).ok();
Cli::clap().gen_completions("tetcore-node", *shell, &path);
}
}