-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.rs
40 lines (31 loc) · 943 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
35
36
37
38
39
40
extern crate git_build_version;
extern crate mime;
extern crate clap;
use clap::Shell;
use std::env;
use std::path::Path;
use std::fs;
include!("src/cli.rs");
fn main() {
gen_completions();
expose_git_describe();
}
fn gen_completions() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let mut path_buf = Path::new(&out_dir).to_path_buf();
path_buf.pop();
path_buf.pop();
path_buf.push("rustysecrets-completions");
let path = path_buf.as_path();
if !path.exists() {
fs::create_dir(path).unwrap();
}
let mut app = build_cli();
app.gen_completions("rustysecrets", Shell::Bash, &path);
app.gen_completions("rustysecrets", Shell::Zsh, &path);
app.gen_completions("rustysecrets", Shell::Fish, &path);
// app.gen_completions("rustysecrets", Shell::PowerShell, &outdir);
}
fn expose_git_describe() {
git_build_version::write_version(".").expect("Saving git version");
}