Skip to content

Commit

Permalink
PR ajeetdsouza#659: Support autocd option
Browse files Browse the repository at this point in the history
  • Loading branch information
mataha committed Jun 15, 2024
1 parent fcbb99a commit 3556a26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/bash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ function __zoxide_z() {
__zoxide_cd "${OLDPWD}"
elif [[ $# -eq 1 && -d $1 ]]; then
__zoxide_cd "$1"
elif [[ $# -eq 2 && -d $2 && $1 == '--' ]]; then
__zoxide_cd "$2"
elif [[ ${@: -1} == "${__zoxide_z_prefix}"?* ]]; then
# shellcheck disable=SC2124
\builtin local result="${@: -1}"
Expand Down
2 changes: 2 additions & 0 deletions templates/posix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ __zoxide_z() {
fi
elif [ "$#" -eq 1 ] && [ -d "$1" ]; then
__zoxide_cd "$1"
elif [ "$#" -eq 2 ] && [ -d "$2" ] && [ "$1" = '--' ]; then
__zoxide_cd "$2"
else
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \builtin true)" -- "$@")" &&
__zoxide_cd "${__zoxide_result}"
Expand Down

0 comments on commit 3556a26

Please sign in to comment.