Fix spacing

This commit is contained in:
Ajeet D'Souza 2022-04-13 16:25:19 +05:30
parent 1987f7e948
commit 75d0a41854
12 changed files with 19 additions and 28 deletions

8
Cargo.lock generated
View File

@ -352,9 +352,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.122" version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec647867e2bf0772e28c8bcde4f0d19a9216916e890543b5a03ed8ef27b8f259" checksum = "cb691a747a7ab48abc15c5b42066eaafde10dc427e3b6ee2a1cf43db04c763bd"
[[package]] [[package]]
name = "log" name = "log"
@ -520,9 +520,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.17" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]

View File

@ -1,8 +1,8 @@
let let
rust = import (builtins.fetchTarball 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 pkgs = import (builtins.fetchTarball
"https://github.com/NixOS/nixpkgs/archive/d19a9162c848517cfc9437f10945b736d718b948.tar.gz") { "https://github.com/NixOS/nixpkgs/archive/d8cec85ca62e9f6c1576a8d87ebd17350710b449.tar.gz") {
overlays = [ rust ]; overlays = [ rust ];
}; };
in pkgs.mkShell { in pkgs.mkShell {

View File

@ -35,6 +35,8 @@ make_template!(Zsh, "zsh.txt");
#[cfg(feature = "nix-dev")] #[cfg(feature = "nix-dev")]
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::{ffi::OsString, os::unix::prelude::OpenOptionsExt};
use askama::Template; use askama::Template;
use assert_cmd::Command; use assert_cmd::Command;
use rstest::rstest; use rstest::rstest;
@ -149,7 +151,7 @@ mod tests {
let source = Nushell(&opts).render().unwrap(); let source = Nushell(&opts).render().unwrap();
let tempdir = tempfile::tempdir().unwrap(); let tempdir = tempfile::tempdir().unwrap();
let tempdir = tempdir.path().to_str().unwrap(); let tempdir = tempdir.path();
let assert = let assert =
Command::new("nu").env("HOME", tempdir).args(&["--commands", &source]).assert().success().stderr(""); Command::new("nu").env("HOME", tempdir).args(&["--commands", &source]).assert().success().stderr("");

View File

@ -58,8 +58,7 @@ fi
{% endif -%} {% endif -%}
{{ section }} {{ section }}
# When using zoxide with --no-cmd, alias these internal functions as # When using zoxide with --no-cmd, alias these internal functions as desired.
# desired.
# #
__zoxide_z_prefix='z#' __zoxide_z_prefix='z#'

View File

@ -41,8 +41,7 @@ if (builtin:not (builtin:eq $E:__zoxide_shlvl $E:SHLVL)) {
{%- endif %} {%- endif %}
{{ section }} {{ section }}
# When using zoxide with --no-cmd, alias these internal functions as # When using zoxide with --no-cmd, alias these internal functions as desired.
# desired.
# #
# Jump to a directory using only keywords. # Jump to a directory using only keywords.

View File

@ -53,8 +53,7 @@ end
{%- endif %} {%- endif %}
{{ section }} {{ section }}
# When using zoxide with --no-cmd, alias these internal functions as # When using zoxide with --no-cmd, alias these internal functions as desired.
# desired.
# #
# Jump to a directory using only keywords. # Jump to a directory using only keywords.

View File

@ -37,8 +37,7 @@ echo "zoxide: PWD hooks are not supported on Nushell.\nUse `zoxide init nushell
{%- endmatch %} {%- endmatch %}
{{ section }} {{ section }}
# When using zoxide with --no-cmd, alias these internal functions as # When using zoxide with --no-cmd, alias these internal functions as desired.
# desired.
# #
# Jump to a directory using only keywords. # Jump to a directory using only keywords.

View File

@ -47,8 +47,7 @@ fi
{%- endmatch %} {%- endmatch %}
{{ section }} {{ section }}
# When using zoxide with --no-cmd, alias these internal functions as # When using zoxide with --no-cmd, alias these internal functions as desired.
# desired.
# #
# Jump to a directory using only keywords. # Jump to a directory using only keywords.

View File

@ -67,8 +67,7 @@ if ($__zoxide_hooked -ne 1) {
} }
{{ section }} {{ section }}
# When using zoxide with --no-cmd, alias these internal functions as # When using zoxide with --no-cmd, alias these internal functions as desired.
# desired.
# #
# Jump to a directory using only keywords. # Jump to a directory using only keywords.

View File

@ -108,8 +108,7 @@ if "__zoxide_hook" not in globals():
{% endif %} {% endif %}
{{ section }} {{ section }}
# When using zoxide with --no-cmd, alias these internal functions as # When using zoxide with --no-cmd, alias these internal functions as desired.
# desired.
# #

View File

@ -46,8 +46,7 @@ fi
{%- endif %} {%- endif %}
{{ section }} {{ section }}
# When using zoxide with --no-cmd, alias these internal functions as # When using zoxide with --no-cmd, alias these internal functions as desired.
# desired.
# #
__zoxide_z_prefix='z#' __zoxide_z_prefix='z#'

View File

@ -136,6 +136,7 @@ fn enable_nix() -> bool {
} }
let nix_enabled = env::var_os("IN_NIX_SHELL").unwrap_or_default() == "pure"; let nix_enabled = env::var_os("IN_NIX_SHELL").unwrap_or_default() == "pure";
if nix_enabled { if nix_enabled {
env::set_var("CARGO_TARGET_DIR", "target_nix");
return true; return true;
} }
let nix_detected = Command::new("nix-shell").arg("--version").status().map(|s| s.success()).unwrap_or(false); 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 args = env::args();
let cmd = shell_words::join(args); let cmd = shell_words::join(args);
let status = Command::new("nix-shell") let status = Command::new("nix-shell").args(&["--pure", "--run", &cmd, "--", "shell.nix"]).status().unwrap();
.args(&["--pure", "--run", &cmd, "--", "shell.nix"])
.env("CARGO_TARGET_DIR", "target_nix")
.status()
.unwrap();
process::exit(status.code().unwrap_or(1)); process::exit(status.code().unwrap_or(1));
} }