As of nushell#12975, path type will fail if a path is unknown, instead of returning an empty string.
This breaks the nushell init script for the first case of the __zoxide_z:
# Jump to a directory using only keywords.
def --env __zoxide_z [...rest:string] {
let arg0 = ($rest | append '~').0
let path = if (($rest | length) <= 1) and ($arg0 == '-' or ($arg0 | path expand | path type) == dir) {
$arg0
} else {
(zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n")
}
cd $path
}
Specifically, if $arg0 is a keyword and is not a path in $env.PWD, then ($arg0 | path expand | path type) will return an error instead of evaluating to false.
As of nushell#12975,
path type
will fail if a path is unknown, instead of returning an empty string.This breaks the nushell init script for the first case of the
__zoxide_z
:Specifically, if
$arg0
is a keyword and is not a path in $env.PWD, then($arg0 | path expand | path type)
will return an error instead of evaluating to false.