diff --git a/Cargo.lock b/Cargo.lock index 7d081ab..65d24b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -352,9 +352,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.122" +version = "0.2.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec647867e2bf0772e28c8bcde4f0d19a9216916e890543b5a03ed8ef27b8f259" +checksum = "cb691a747a7ab48abc15c5b42066eaafde10dc427e3b6ee2a1cf43db04c763bd" [[package]] name = "log" @@ -520,9 +520,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] diff --git a/shell.nix b/shell.nix index d2ec04a..9dac5b6 100644 --- a/shell.nix +++ b/shell.nix @@ -1,8 +1,8 @@ let rust = import (builtins.fetchTarball - "https://github.com/oxalica/rust-overlay/archive/46d8d20fce510c6a25fa66f36e31f207f6ea49e4.tar.gz"); + "https://github.com/oxalica/rust-overlay/archive/80868ba348db2b5e733483454cbb5770f2951077.tar.gz"); pkgs = import (builtins.fetchTarball - "https://github.com/NixOS/nixpkgs/archive/d19a9162c848517cfc9437f10945b736d718b948.tar.gz") { + "https://github.com/NixOS/nixpkgs/archive/d8cec85ca62e9f6c1576a8d87ebd17350710b449.tar.gz") { overlays = [ rust ]; }; in pkgs.mkShell { diff --git a/src/shell.rs b/src/shell.rs index 79554f4..229e005 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -35,6 +35,8 @@ make_template!(Zsh, "zsh.txt"); #[cfg(feature = "nix-dev")] #[cfg(test)] mod tests { + use std::{ffi::OsString, os::unix::prelude::OpenOptionsExt}; + use askama::Template; use assert_cmd::Command; use rstest::rstest; @@ -149,7 +151,7 @@ mod tests { let source = Nushell(&opts).render().unwrap(); let tempdir = tempfile::tempdir().unwrap(); - let tempdir = tempdir.path().to_str().unwrap(); + let tempdir = tempdir.path(); let assert = Command::new("nu").env("HOME", tempdir).args(&["--commands", &source]).assert().success().stderr(""); diff --git a/templates/bash.txt b/templates/bash.txt index 9ee60fa..9b3c9f4 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -58,8 +58,7 @@ fi {% endif -%} {{ section }} -# When using zoxide with --no-cmd, alias these internal functions as -# desired. +# When using zoxide with --no-cmd, alias these internal functions as desired. # __zoxide_z_prefix='z#' diff --git a/templates/elvish.txt b/templates/elvish.txt index 5256756..a236c8b 100644 --- a/templates/elvish.txt +++ b/templates/elvish.txt @@ -41,8 +41,7 @@ if (builtin:not (builtin:eq $E:__zoxide_shlvl $E:SHLVL)) { {%- endif %} {{ section }} -# When using zoxide with --no-cmd, alias these internal functions as -# desired. +# When using zoxide with --no-cmd, alias these internal functions as desired. # # Jump to a directory using only keywords. diff --git a/templates/fish.txt b/templates/fish.txt index c73a987..683a326 100644 --- a/templates/fish.txt +++ b/templates/fish.txt @@ -53,8 +53,7 @@ end {%- endif %} {{ section }} -# When using zoxide with --no-cmd, alias these internal functions as -# desired. +# When using zoxide with --no-cmd, alias these internal functions as desired. # # Jump to a directory using only keywords. diff --git a/templates/nushell.txt b/templates/nushell.txt index c178760..e9c08cb 100644 --- a/templates/nushell.txt +++ b/templates/nushell.txt @@ -37,8 +37,7 @@ echo "zoxide: PWD hooks are not supported on Nushell.\nUse `zoxide init nushell {%- endmatch %} {{ section }} -# When using zoxide with --no-cmd, alias these internal functions as -# desired. +# When using zoxide with --no-cmd, alias these internal functions as desired. # # Jump to a directory using only keywords. diff --git a/templates/posix.txt b/templates/posix.txt index 29989d3..f9fd9a5 100644 --- a/templates/posix.txt +++ b/templates/posix.txt @@ -47,8 +47,7 @@ fi {%- endmatch %} {{ section }} -# When using zoxide with --no-cmd, alias these internal functions as -# desired. +# When using zoxide with --no-cmd, alias these internal functions as desired. # # Jump to a directory using only keywords. diff --git a/templates/powershell.txt b/templates/powershell.txt index 69e904c..6c89fc1 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -67,8 +67,7 @@ if ($__zoxide_hooked -ne 1) { } {{ section }} -# When using zoxide with --no-cmd, alias these internal functions as -# desired. +# When using zoxide with --no-cmd, alias these internal functions as desired. # # Jump to a directory using only keywords. diff --git a/templates/xonsh.txt b/templates/xonsh.txt index f6f7802..07baee5 100644 --- a/templates/xonsh.txt +++ b/templates/xonsh.txt @@ -108,8 +108,7 @@ if "__zoxide_hook" not in globals(): {% endif %} {{ section }} -# When using zoxide with --no-cmd, alias these internal functions as -# desired. +# When using zoxide with --no-cmd, alias these internal functions as desired. # diff --git a/templates/zsh.txt b/templates/zsh.txt index 545de74..ded2f34 100644 --- a/templates/zsh.txt +++ b/templates/zsh.txt @@ -46,8 +46,7 @@ fi {%- endif %} {{ section }} -# When using zoxide with --no-cmd, alias these internal functions as -# desired. +# When using zoxide with --no-cmd, alias these internal functions as desired. # __zoxide_z_prefix='z#' diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 69df33d..4af61c6 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -136,6 +136,7 @@ fn enable_nix() -> bool { } let nix_enabled = env::var_os("IN_NIX_SHELL").unwrap_or_default() == "pure"; if nix_enabled { + env::set_var("CARGO_TARGET_DIR", "target_nix"); return true; } let nix_detected = Command::new("nix-shell").arg("--version").status().map(|s| s.success()).unwrap_or(false); @@ -147,10 +148,6 @@ fn enable_nix() -> bool { let args = env::args(); let cmd = shell_words::join(args); - let status = Command::new("nix-shell") - .args(&["--pure", "--run", &cmd, "--", "shell.nix"]) - .env("CARGO_TARGET_DIR", "target_nix") - .status() - .unwrap(); + let status = Command::new("nix-shell").args(&["--pure", "--run", &cmd, "--", "shell.nix"]).status().unwrap(); process::exit(status.code().unwrap_or(1)); }