diff --git a/README b/README index 778989a..7de82a4 100644 --- a/README +++ b/README @@ -60,7 +60,7 @@ NOTES Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution. Set $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your- self. - Set $_Z_EXCLUDE_DIRS to an array of directories to exclude. + Set $_Z_EXCLUDE_DIRS to an array of directory trees to exclude. Set $_Z_OWNER to allow usage when in 'sudo -s' mode. (These settings should go in .bashrc/.zshrc before the line added above.) @@ -121,8 +121,8 @@ ENVIRONMENT to handle PROMPT_COMMAND or precmd yourself. The environment variable $_Z_EXCLUDE_DIRS can be set to an array of - directories to exclude from tracking. $HOME is always excluded. Direc- - tories must be full paths without trailing slashes. + directory trees to exclude from tracking. $HOME is always excluded. + Directories must be full paths without trailing slashes. The environment variable $_Z_OWNER can be set to your username, to allow usage of z when your sudo enviroment keeps $HOME set. diff --git a/z.1 b/z.1 index bba9d78..cc99910 100644 --- a/z.1 +++ b/z.1 @@ -81,7 +81,7 @@ Set \fB$_Z_NO_RESOLVE_SYMLINKS\fR to prevent symlink resolution. Set \fB$_Z_NO_PROMPT_COMMAND\fR to handle \fBPROMPT_COMMAND/precmd\fR yourself. .RE .RS -Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directories to exclude. +Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directory trees to exclude. .RE .RS Set \fB$_Z_OWNER\fR to allow usage when in 'sudo -s' mode. @@ -147,7 +147,7 @@ The environment variable \fB$_Z_NO_PROMPT_COMMAND\fR can be set if you want to handle \fBPROMPT_COMMAND\fR or \fBprecmd\fR yourself. .P The environment variable \fB$_Z_EXCLUDE_DIRS\fR can be set to an array of -directories to exclude from tracking. \fB$HOME\fR is always excluded. +directory trees to exclude from tracking. \fB$HOME\fR is always excluded. Directories must be full paths without trailing slashes. .P The environment variable \fB$_Z_OWNER\fR can be set to your username, to diff --git a/z.sh b/z.sh index a8c6a89..9510468 100644 --- a/z.sh +++ b/z.sh @@ -41,10 +41,10 @@ _z() { # $HOME isn't worth matching [ "$*" = "$HOME" ] && return - # don't track excluded dirs + # don't track excluded directory trees local exclude for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do - [ "$*" = "$exclude" ] && return + case "$*" in $exclude*) return;; esac done # maintain the data file