Closed dazfuller closed 1 month ago
So I ran into this issue this morning as well, I think I have something that works but it's ugly:
# Jump to a directory using only keywords.
def --env __zoxide_z [...rest:string] {
let arg0 = ($rest | append '~').0
# Expand the path first
let arg_path = ($arg0 | path expand)
# First check if the path exists before checking it's a directory
let path = if (($rest | length) <= 1) and ($arg0 == '-' or (($arg_path | path exists) and ($arg_path | path type) == dir)) {
$arg0
} else {
(zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n")
}
cd $path
}
Damn, fixed before I'd hit brew update this morning 😆
Gonna close this then as it's all in hand
The changes in the latest release of nu has broken the generated
__zoxide_z
in the.zoxide.nu
file as thepath type
command now throws an error if the file/dir does not exist.I've gotten it working again in my local environment by changing the command to the following
This way it explicitly checks if the path exists before checking it's type. Not sure if there's an easier way to do it as my NuShell scripting isn't that great.