-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
40 lines (34 loc) · 1.09 KB
/
Copy pathbuild.rs
File metadata and controls
40 lines (34 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use clap::CommandFactory;
use clap_complete::{Shell, generate_to};
use std::env;
mod cli {
#![allow(unused)]
mod tool_types {
include!("src/cli/clap_tools.rs");
}
pub mod paths {
include!("src/cli/paths.rs");
}
pub mod clap_helpers {
include!("src/cli/clap_helpers.rs");
}
use crate::cli::tool_types::*;
include!("src/cli/clap_.rs");
}
include!("build/completions_mock.rs");
// -----------------------------------------------------------------------------
// Include
// -----------------------------------------------------------------------------
include!("src/cli/clap.rs");
fn main() {
let out_dir = {
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let out_dir = manifest_dir.join("assets").join("completions");
std::fs::create_dir_all(&out_dir).unwrap();
out_dir
};
let mut cmd = CliWithDefault::command();
for shell in [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell] {
generate_to(shell, &mut cmd, cli::paths::BINARY_SHORT, &out_dir).unwrap();
}
}