Fix `cd`ing home when no matching directory in `fish`

Prior to this change, executing `z sjlk` (assuming no `sjlk` directory
in your database) would result in going back to the user's home.
This commit is contained in:
Cole Helbling 2020-04-10 15:06:23 -07:00
parent 0d860503ae
commit 1e4a81e659
No known key found for this signature in database
GPG Key ID: B37E0F2371016A4C
2 changed files with 5 additions and 5 deletions

View File

@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Interactive mode in `zoxide` no longer throws an error if `fzf` exits gracefully.
- Canonicalize to regular paths instead of UNC paths on Windows.
### Fixed
- When no match is found, `fish` stays in the current directory.
## [0.3.1] - 2020-04-03
### Added

View File

@ -160,15 +160,11 @@ function {}
or return $status
else
# FIXME: use string-collect from fish 3.1.0 once it has wider adoption
set -l IFS ''
set -l result (zoxide query $argv)
if test -d $result
if begin; test -d $result; and string length -q -- $result; end
_z_cd $result
or return $status
else if test -n "$result"
echo $result
end
end
end