mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-05 02:55:31 +00:00
chore: allow overriding the completions output directory
This commit is contained in:
parent
20e2044bd0
commit
f4c8295519
8
build.rs
8
build.rs
@ -1,4 +1,4 @@
|
||||
use std::{env, fs::create_dir_all, path::Path};
|
||||
use std::{env, fs::create_dir_all};
|
||||
|
||||
use clap::{ArgEnum, IntoApp};
|
||||
use clap_complete::{generate_to, Shell};
|
||||
@ -12,7 +12,11 @@ fn main() {
|
||||
return;
|
||||
}
|
||||
|
||||
let out = &Path::new(&env::var_os("OUT_DIR").unwrap()).join("completions");
|
||||
let out = &env::var_os("OUCH_COMPLETIONS_DIR")
|
||||
.map(|path| PathBuf::from(&path))
|
||||
.or_else(|| env::var_os("OUT_DIR").map(|path| PathBuf::from(&path)).map(|path| path.join("completions")))
|
||||
.unwrap();
|
||||
|
||||
create_dir_all(out).unwrap();
|
||||
let app = &mut Opts::into_app();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user