Bash/POSIX: check directory existence using cd
This commit is contained in:
parent
ad5ea87783
commit
d0a6843d2b
|
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `import` now skips directories matching `$_ZO_EXCLUDE_DIRS`.
|
||||
- POSIX: support for non-Cygwin Windows environments (e.g. Busybox).
|
||||
- Fish: Space-Tab completions now display and run the selected command.
|
||||
- Bash/POSIX: `z` now honors `$CDPATH`.
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
@ -24,7 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
|
||||
- Bash/Fish/POSIX/Zsh: resolve symlinks on Windows.
|
||||
- Bash/POSIX: `z` now handles relative paths through symlinked directories.
|
||||
- Bash/Fish/POSIX/Zsh: `_ZO_RESOLVE_SYMLINKS` now works on Windows.
|
||||
- Bash: handle `$PROMPT_COMMAND` values ending in a semicolon.
|
||||
- PowerShell: navigate to home directory with `z` on drives that don't define `HOME`.
|
||||
- PowerShell: use fully qualified names when invoking cmdlets.
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ function __zoxide_z() {
|
|||
__zoxide_cd ~
|
||||
elif [[ $# -eq 1 && $1 == '-' ]]; then
|
||||
__zoxide_cd "${OLDPWD}"
|
||||
elif [[ $# -eq 1 && -d $1 ]]; then
|
||||
elif [[ $# -eq 1 ]] && (\builtin cd -- "$1") &>/dev/null; then
|
||||
__zoxide_cd "$1"
|
||||
elif [[ $# -eq 2 && $1 == '--' ]]; then
|
||||
__zoxide_cd "$2"
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ __zoxide_z() {
|
|||
\command printf 'zoxide: $OLDPWD is not set'
|
||||
return 1
|
||||
fi
|
||||
elif [ "$#" -eq 1 ] && [ -d "$1" ]; then
|
||||
elif [ "$#" -eq 1 ] && (\command cd -- "$1") >/dev/null 2>&1; then
|
||||
__zoxide_cd "$1"
|
||||
else
|
||||
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \command true)" -- "$@")" &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue