-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.rs
34 lines (29 loc) · 969 Bytes
/
build.rs
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
use std::io::Error;
#[cfg(feature = "completions")]
use clap::{Command, CommandFactory};
#[cfg(feature = "completions")]
use clap_complete::{generate_to, Shell};
include!("src/cli.rs");
fn main() -> Result<(), Error> {
#[cfg(feature = "completions")]
{
let outdir = if PathBuf::from("../target").exists() {
"../target/"
} else if PathBuf::from("target").exists() {
"./target/"
} else {
return Ok(());
};
let bin_name = "dynisland";
let mut cmd: Command = Cli::command_for_update();
let shells: [Shell; 4] = [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::Elvish];
for shell in shells {
let _path = generate_to(shell, &mut cmd, bin_name, &outdir)?;
// println!(
// "cargo:warning=completion file for {shell} is generated in {}",
// _path.to_str().unwrap()
// );
}
}
Ok(())
}