feature: make it possible to override generate dirs via env (#1658)
This commit is contained in:
parent
1edd8d81ed
commit
cf91c73b60
9
build.rs
9
build.rs
|
@ -38,11 +38,12 @@ fn btm_generate() -> io::Result<()> {
|
|||
|
||||
match env::var_os(ENV_KEY) {
|
||||
Some(var) if !var.is_empty() => {
|
||||
const COMPLETION_DIR: &str = "./target/tmp/bottom/completion/";
|
||||
const MANPAGE_DIR: &str = "./target/tmp/bottom/manpage/";
|
||||
let completion_dir =
|
||||
option_env!("COMPLETION_DIR").unwrap_or("./target/tmp/bottom/completion/");
|
||||
let manpage_dir = option_env!("MANPAGE_DIR").unwrap_or("./target/tmp/bottom/manpage/");
|
||||
|
||||
let completion_out_dir = PathBuf::from(COMPLETION_DIR);
|
||||
let manpage_out_dir = PathBuf::from(MANPAGE_DIR);
|
||||
let completion_out_dir = PathBuf::from(completion_dir);
|
||||
let manpage_out_dir = PathBuf::from(manpage_dir);
|
||||
|
||||
create_dir(&completion_out_dir)?;
|
||||
create_dir(&manpage_out_dir)?;
|
||||
|
|
|
@ -54,6 +54,9 @@ This will automatically generate completion and manpage files in `target/tmp/bot
|
|||
files, modify/delete either these files or set `BTM_GENERATE` to some other non-empty value to retrigger the build
|
||||
script.
|
||||
|
||||
You may override the default diretories used to generate both completion and manpage files by specifying the
|
||||
`COMPLETION_DIR` and `MANPAGE_DIR` environment variables respectively.
|
||||
|
||||
For more information, you may want to look at either the [`build.rs`](https://github.com/ClementTsang/bottom/blob/main/build.rs)
|
||||
file or the [binary build CI workflow](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/build_releases.yml).
|
||||
|
||||
|
|
Loading…
Reference in New Issue