fix(shell): substitute pwd before cygpath
This commit is contained in:
parent
f84f9a3e1d
commit
95ef186f7f
20
src/shell.rs
20
src/shell.rs
|
|
@ -33,6 +33,26 @@ make_template!(Tcsh, "tcsh.txt");
|
||||||
make_template!(Xonsh, "xonsh.txt");
|
make_template!(Xonsh, "xonsh.txt");
|
||||||
make_template!(Zsh, "zsh.txt");
|
make_template!(Zsh, "zsh.txt");
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod template_tests {
|
||||||
|
#[test]
|
||||||
|
fn windows_bash_and_zsh_pwd_substitute_before_cygpath() {
|
||||||
|
for (name, template) in [
|
||||||
|
("bash", include_str!("../templates/bash.txt")),
|
||||||
|
("zsh", include_str!("../templates/zsh.txt")),
|
||||||
|
] {
|
||||||
|
assert!(
|
||||||
|
template.contains(r#"\command cygpath -w "$({{ pwd }})""#),
|
||||||
|
"{name} template should pass the output of pwd to cygpath"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
!template.contains(r#"\command cygpath -w "{{ pwd }}""#),
|
||||||
|
"{name} template should not pass the literal pwd command to cygpath"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nix-dev")]
|
#[cfg(feature = "nix-dev")]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ function __zoxide_pwd() {
|
||||||
{%- let pwd = "\\builtin pwd -L" -%}
|
{%- let pwd = "\\builtin pwd -L" -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if cfg!(windows) %}
|
{%- if cfg!(windows) %}
|
||||||
\command cygpath -w "{{ pwd }}"
|
\command cygpath -w "$({{ pwd }})"
|
||||||
{%- else %}
|
{%- else %}
|
||||||
{{ pwd }}
|
{{ pwd }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ function __zoxide_pwd() {
|
||||||
{%- let pwd = "\\builtin pwd -L" -%}
|
{%- let pwd = "\\builtin pwd -L" -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if cfg!(windows) %}
|
{%- if cfg!(windows) %}
|
||||||
\command cygpath -w "{{ pwd }}"
|
\command cygpath -w "$({{ pwd }})"
|
||||||
{%- else %}
|
{%- else %}
|
||||||
{{ pwd }}
|
{{ pwd }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue