-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
28 lines (21 loc) · 709 Bytes
/
build.rs
File metadata and controls
28 lines (21 loc) · 709 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
extern crate structopt;
use std::ffi::OsStr;
use std::fs::File;
use std::{env, path::PathBuf};
use structopt::clap::Shell;
include!("src/cli.rs");
fn main() {
let target_dir = match env::var_os("OUT_DIR") {
// if no OUT_DIR, no need to write man/completions
None => return,
Some(outdir) => outdir,
};
generate_completions(&target_dir);
let anchor = PathBuf::from(&target_dir).join("https-cert-info-stamp");
File::create(&anchor).unwrap();
}
fn generate_completions(target_dir: &OsStr) {
for shell in &[Shell::Bash, Shell::Fish, Shell::Zsh, Shell::PowerShell] {
Command::clap().gen_completions(env!("CARGO_PKG_NAME"), *shell, target_dir);
}
}