Skip to content

Commit

Permalink
feature: make it possible to override generate dirs via env (#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimian authored Jan 18, 2025
1 parent 1edd8d8 commit cf91c73
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -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)?;
3 changes: 3 additions & 0 deletions docs/content/contribution/packaging-and-distribution.md
Original file line number Diff line number Diff line change
@@ -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).

0 comments on commit cf91c73

Please sign in to comment.