-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
32 lines (25 loc) · 748 Bytes
/
Copy pathbuild.rs
File metadata and controls
32 lines (25 loc) · 748 Bytes
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
fn main() {
println!("cargo:rerun-if-changed=build.rs");
#[cfg(feature = "completions")]
{
println!("cargo:rerun-if-changed=src/cli.rs");
generate_completions();
}
}
#[cfg(feature = "completions")]
fn generate_completions() {
use std::env;
use clap_complete::{generate_to, Shell::Bash};
use crate::cli::Cli;
let outdir = match env::var_os("OUT_DIR") {
None => return,
Some(outdir) => outdir,
};
let mut cmd = Cli::build_cli();
let path = generate_to(Bash, &mut cmd, "minilisp", outdir).unwrap();
println!("cargo:warning=clap complete file generated at: {}", path.display());
}
#[cfg(feature = "completions")]
#[allow(dead_code)]
#[path = "src/cli.rs"]
mod cli;