41 lines
1.1 KiB
Diff
41 lines
1.1 KiB
Diff
From 60763a64c1b7268050bb61fb8cef1c982bbd4aca Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?=
|
|
<jan.christian@gruenhage.xyz>
|
|
Date: Sun, 13 Feb 2022 09:53:28 +0100
|
|
Subject: [PATCH 1/2] chore: allow overriding the completions output directory
|
|
|
|
---
|
|
build.rs | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/build.rs b/build.rs
|
|
index 5372154..b5c56c4 100644
|
|
--- a/build.rs
|
|
+++ b/build.rs
|
|
@@ -1,7 +1,7 @@
|
|
use clap::{ArgEnum, IntoApp};
|
|
use clap_generate::{generate_to, Shell};
|
|
|
|
-use std::{env, fs::create_dir_all, path::Path};
|
|
+use std::{env, fs::create_dir_all};
|
|
|
|
include!("src/opts.rs");
|
|
|
|
@@ -12,7 +12,13 @@ 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();
|
|
|
|
--
|
|
2.35.1
|