diff options
author | Ryan Zegray <ryan.zegray@gmail.com> | 2021-10-06 04:14:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 10:14:22 +0200 |
commit | 7418814677a1b64d584d84be03fbfe38c7760e61 (patch) | |
tree | 7d016b036382edd3b4c5820b043234526a9098fb /plugins | |
parent | bf7c1b160d164f080a276e6ed6b21ef8008079ee (diff) | |
download | zsh-7418814677a1b64d584d84be03fbfe38c7760e61.tar.gz zsh-7418814677a1b64d584d84be03fbfe38c7760e61.tar.bz2 zsh-7418814677a1b64d584d84be03fbfe38c7760e61.zip |
feat(z): update z to latest version (#10267)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/z/z.sh | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/z/z.sh b/plugins/z/z.sh index 13008a60e..67f504e27 100644 --- a/plugins/z/z.sh +++ b/plugins/z/z.sh @@ -42,6 +42,8 @@ _z() { [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return _z_dirs () { + [ -f "$datafile" ] || return + local line while read line; do # only count directories @@ -54,14 +56,16 @@ _z() { if [ "$1" = "--add" ]; then shift - # $HOME isn't worth matching - [ "$*" = "$HOME" ] && return + # $HOME and / aren't worth matching + [ "$*" = "$HOME" -o "$*" = '/' ] && return # don't track excluded directory trees - local exclude - for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do - case "$*" in "$exclude*") return;; esac - done + if [ ${#_Z_EXCLUDE_DIRS[@]} -gt 0 ]; then + local exclude + for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do + case "$*" in "$exclude"*) return;; esac + done + fi # maintain the data file local tempfile="$datafile.$RANDOM" |