fixed nushell init for new `path type` behavior (#830)

This commit is contained in:
dedebenui 2024-05-29 09:45:56 +02:00 committed by GitHub
parent df0f6e525c
commit 1a4c4933ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -41,7 +41,8 @@ if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) {
# Jump to a directory using only keywords. # Jump to a directory using only keywords.
def --env --wrapped __zoxide_z [...rest:string] { def --env --wrapped __zoxide_z [...rest:string] {
let arg0 = ($rest | append '~').0 let arg0 = ($rest | append '~').0
let path = if (($rest | length) <= 1) and ($arg0 == '-' or ($arg0 | path expand | path type) == dir) { let arg0_is_dir = (try {$arg0 | path expand | path type}) == 'dir'
let path = if (($rest | length) <= 1) and ($arg0 == '-' or $arg0_is_dir) {
$arg0 $arg0
} else { } else {
(zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n") (zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n")