mirror of
https://github.com/sharkdp/bat
synced 2024-11-23 04:13:11 +00:00
Immutably construct variables map
This commit is contained in:
parent
6d0ef259f6
commit
2710a19ecb
1 changed files with 8 additions and 5 deletions
13
build.rs
13
build.rs
|
@ -18,11 +18,14 @@ fn gen_man_and_comp() -> anyhow::Result<()> {
|
||||||
let executable_name_uppercase = executable_name.to_uppercase();
|
let executable_name_uppercase = executable_name.to_uppercase();
|
||||||
let project_version = env::var("CARGO_PKG_VERSION")?;
|
let project_version = env::var("CARGO_PKG_VERSION")?;
|
||||||
|
|
||||||
let mut variables = HashMap::new();
|
let variables = [
|
||||||
variables.insert("PROJECT_NAME", project_name);
|
("PROJECT_NAME", project_name),
|
||||||
variables.insert("PROJECT_EXECUTABLE", executable_name);
|
("PROJECT_EXECUTABLE", executable_name),
|
||||||
variables.insert("PROJECT_EXECUTABLE_UPPERCASE", executable_name_uppercase);
|
("PROJECT_EXECUTABLE_UPPERCASE", executable_name_uppercase),
|
||||||
variables.insert("PROJECT_VERSION", project_version);
|
("PROJECT_VERSION", project_version),
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.collect();
|
||||||
|
|
||||||
let Some(out_dir) = env::var_os("BAT_ASSETS_GEN_DIR")
|
let Some(out_dir) = env::var_os("BAT_ASSETS_GEN_DIR")
|
||||||
.or_else(|| env::var_os("OUT_DIR"))
|
.or_else(|| env::var_os("OUT_DIR"))
|
||||||
|
|
Loading…
Reference in a new issue