From 5b2c9222f9737a828438b487d9d8fd37f5bba81b Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Sat, 16 Mar 2024 12:30:19 +0530 Subject: [PATCH] pwsh: handle queries that look like args (#760) --- CHANGELOG.md | 1 + templates/powershell.txt | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95e7b78..899316b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - fish: detect infinite loop when using `alias cd=z`. +- fish / PowerShell: handle queries that look like args (e.g. `z -x`). ## [0.9.4] - 2024-02-21 diff --git a/templates/powershell.txt b/templates/powershell.txt index 4a23246..86b1966 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -62,7 +62,7 @@ function global:__zoxide_cd($dir, $literal) { function global:__zoxide_hook { $result = __zoxide_pwd if ($null -ne $result) { - zoxide add -- $result + zoxide add "--" $result } } {%- else if hook == InitHook::Pwd -%} @@ -72,7 +72,7 @@ function global:__zoxide_hook { $result = __zoxide_pwd if ($result -ne $global:__zoxide_oldpwd) { if ($null -ne $result) { - zoxide add -- $result + zoxide add "--" $result } $global:__zoxide_oldpwd = $result } @@ -112,10 +112,10 @@ function global:__zoxide_z { else { $result = __zoxide_pwd if ($null -ne $result) { - $result = __zoxide_bin query --exclude $result -- @args + $result = __zoxide_bin query --exclude $result "--" @args } else { - $result = __zoxide_bin query -- @args + $result = __zoxide_bin query "--" @args } if ($LASTEXITCODE -eq 0) { __zoxide_cd $result $true @@ -125,7 +125,7 @@ function global:__zoxide_z { # Jump to a directory using interactive search. function global:__zoxide_zi { - $result = __zoxide_bin query -i -- @args + $result = __zoxide_bin query -i "--" @args if ($LASTEXITCODE -eq 0) { __zoxide_cd $result $true }