pwsh: handle queries that look like args (#760)

This commit is contained in:
Ajeet D'Souza 2024-03-16 12:30:19 +05:30 committed by GitHub
parent 88d494fc2d
commit 5b2c9222f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- fish: detect infinite loop when using `alias cd=z`. - 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 ## [0.9.4] - 2024-02-21

View File

@ -62,7 +62,7 @@ function global:__zoxide_cd($dir, $literal) {
function global:__zoxide_hook { function global:__zoxide_hook {
$result = __zoxide_pwd $result = __zoxide_pwd
if ($null -ne $result) { if ($null -ne $result) {
zoxide add -- $result zoxide add "--" $result
} }
} }
{%- else if hook == InitHook::Pwd -%} {%- else if hook == InitHook::Pwd -%}
@ -72,7 +72,7 @@ function global:__zoxide_hook {
$result = __zoxide_pwd $result = __zoxide_pwd
if ($result -ne $global:__zoxide_oldpwd) { if ($result -ne $global:__zoxide_oldpwd) {
if ($null -ne $result) { if ($null -ne $result) {
zoxide add -- $result zoxide add "--" $result
} }
$global:__zoxide_oldpwd = $result $global:__zoxide_oldpwd = $result
} }
@ -112,10 +112,10 @@ function global:__zoxide_z {
else { else {
$result = __zoxide_pwd $result = __zoxide_pwd
if ($null -ne $result) { if ($null -ne $result) {
$result = __zoxide_bin query --exclude $result -- @args $result = __zoxide_bin query --exclude $result "--" @args
} }
else { else {
$result = __zoxide_bin query -- @args $result = __zoxide_bin query "--" @args
} }
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {
__zoxide_cd $result $true __zoxide_cd $result $true
@ -125,7 +125,7 @@ function global:__zoxide_z {
# Jump to a directory using interactive search. # Jump to a directory using interactive search.
function global:__zoxide_zi { function global:__zoxide_zi {
$result = __zoxide_bin query -i -- @args $result = __zoxide_bin query -i "--" @args
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {
__zoxide_cd $result $true __zoxide_cd $result $true
} }