Added . and .. cases

This commit is contained in:
Martin Chen 2026-04-22 15:22:14 +10:00
parent 67ca1bc959
commit cad4eb63d3
4 changed files with 10 additions and 0 deletions

View File

@ -111,6 +111,10 @@ function __zoxide_z() {
__zoxide_cd ~
elif [[ $# -eq 1 && $1 == '-' ]]; then
__zoxide_cd "${OLDPWD}"
elif [[ $# -eq 1 && $1 == '~' ]]; then
__zoxide_cd ~
elif [[ $# -eq 1 && ($1 == '.' || $1 == '..') ]]; then
__zoxide_cd "$1"
elif [[ $# -eq 1 && -d $1 ]]; then
__zoxide_cd "$1"
elif [[ $# -eq 2 && $1 == '--' ]]; then

View File

@ -79,6 +79,8 @@ function __zoxide_z
__zoxide_cd $HOME
else if test "$argv" = -
__zoxide_cd -
else if test $argc -eq 1 -a \( "$argv[1]" = '.' -o "$argv[1]" = '..' \)
__zoxide_cd $argv[1]
else if test $argc -eq 1 -a -d $argv[1]
__zoxide_cd $argv[1]
else if test $argc -eq 2 -a $argv[1] = --

View File

@ -105,6 +105,8 @@ __zoxide_z() {
\command printf 'zoxide: $OLDPWD is not set'
return 1
fi
elif [ "$#" -eq 1 ] && [ "$1" = '.' -o "$1" = '..' ]; then
__zoxide_cd "$1"
elif [ "$#" -eq 1 ] && [ -d "$1" ]; then
__zoxide_cd "$1"
else

View File

@ -88,6 +88,8 @@ function __zoxide_z() {
__zoxide_doctor
if [[ "$#" -eq 0 ]]; then
__zoxide_cd ~
elif [[ "$#" -eq 1 && ($1 == '.' || $1 == '..') ]]; then
__zoxide_cd "$1"
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]+$ ]]; }; then
__zoxide_cd "$1"
elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then