-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.rs
32 lines (24 loc) · 1.05 KB
/
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
include!("src/cli.rs");
use std::fs;
use std::path::PathBuf;
fn main() {
let name = std::env::var("CARGO_PKG_NAME").unwrap();
let _target = std::env::var("TARGET").unwrap();
let manifest = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let profile = std::env::var("PROFILE").unwrap();
let root = PathBuf::from(manifest);
let license = root.join("LICENSE");
let readme = root.join("README.md");
let outdir = root.join("target").join(profile);
let completions = outdir.join("completions");
if !completions.exists() {
fs::create_dir_all(&completions).unwrap();
}
Cli::clap().gen_completions(&name, Shell::Bash, &completions);
Cli::clap().gen_completions(&name, Shell::Zsh, &completions);
Cli::clap().gen_completions(&name, Shell::Fish, &completions);
Cli::clap().gen_completions(&name, Shell::Elvish, &completions);
Cli::clap().gen_completions(&name, Shell::PowerShell, &completions);
fs::copy(license, outdir.join("LICENSE")).unwrap();
fs::copy(readme, outdir.join("README.md")).unwrap();
}