also ignore subdirs of _Z_EXCLUDE_DIRS

This commit is contained in:
rupa committed 2015-02-14 13:24:04 -05:00
1 parent b620b0a8af
commit c507bdd707
3 files changed
+7 -7

No files matched your search

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