From af8d0e678603bc922ba2249d05872f08a596136d Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Tue, 19 Dec 2023 18:56:57 +0100 Subject: [PATCH] fix building shell completions and man pages --- build.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index 1a844ad..be4e686 100644 --- a/build.rs +++ b/build.rs @@ -25,16 +25,14 @@ fn main() { dump_help(sq.clone()).unwrap(); // Generate shell completions - let outdir = match env::var_os("CARGO_TARGET_DIR") { - None => return, - Some(outdir) => outdir, - }; + let out_dir = std::path::PathBuf::from( + std::env::var_os("OUT_DIR").ok_or(std::io::ErrorKind::NotFound).unwrap()); - fs::create_dir_all(&outdir).unwrap(); + fs::create_dir_all(&out_dir).unwrap(); for shell in &[Shell::Bash, Shell::Fish, Shell::Zsh, Shell::PowerShell, Shell::Elvish] { - let path = clap_complete::generate_to(*shell, &mut sq, "sq", &outdir).unwrap(); + let path = clap_complete::generate_to(*shell, &mut sq, "sq", &out_dir).unwrap(); println!("cargo:warning=completion file is generated: {:?}", path); }; -- 2.43.0