From: martin f. krafft Date: Wed, 14 May 2008 19:47:02 +0000 (+0100) Subject: add support for parts.d dirs X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/c3bb27de5d481b62b216517098064472dd11b9c6?hp=61f315793f3fcd7d22456d2a0057efbf88191fda add support for parts.d dirs --- diff --git a/.zsh/rcsstub b/.zsh/rcsstub index 0f30dc6..b7736de 100644 --- a/.zsh/rcsstub +++ b/.zsh/rcsstub @@ -8,15 +8,21 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -. $ZDOTDIR/logging -. $ZDOTDIR/util - if [[ -o rcs ]]; then + source $ZDOTDIR/logging + source $ZDOTDIR/util + source $ZDOTDIR/sourcedir + # __do_debug && set -x || : - file="%1N"; file="${(%)file}" - . $ZDOTDIR/sourcedir - sourcedir $ZDOTDIR/${file#.} + _DIR=$ZDOTDIR/${${(%):-%1N}#.} + sourcedir $_DIR + + if [[ -d $_DIR/parts.d ]]; then + sourcedir $_DIR/parts.d + fi + + unset _DIR # __do_debug && set +x || : fi diff --git a/.zsh/sourcedir b/.zsh/sourcedir index 4ce51a8..bb90720 100644 --- a/.zsh/sourcedir +++ b/.zsh/sourcedir @@ -12,6 +12,7 @@ sourcedir() { if [ ! -d "$1" ]; then + error "no such directory: $1" return 1 fi # debug "sourcing directory ${1#$ZDOTDIR/}" @@ -20,7 +21,7 @@ sourcedir() { *~|*.bak|*.old|*.sw?|*.zwc|*.disabled) continue;; esac # debug " sourcing file $f" - . "$f" + source "$f" done } diff --git a/.zsh/zlogin/.gitignore b/.zsh/zlogin/.gitignore new file mode 100644 index 0000000..53363b0 --- /dev/null +++ b/.zsh/zlogin/.gitignore @@ -0,0 +1 @@ +/parts.d diff --git a/.zsh/zlogout/.gitignore b/.zsh/zlogout/.gitignore new file mode 100644 index 0000000..53363b0 --- /dev/null +++ b/.zsh/zlogout/.gitignore @@ -0,0 +1 @@ +/parts.d diff --git a/.zsh/zprofile/.gitignore b/.zsh/zprofile/.gitignore new file mode 100644 index 0000000..53363b0 --- /dev/null +++ b/.zsh/zprofile/.gitignore @@ -0,0 +1 @@ +/parts.d diff --git a/.zsh/zprofile/40_zcompile b/.zsh/zprofile/40_zcompile index 174a757..925c3de 100644 --- a/.zsh/zprofile/40_zcompile +++ b/.zsh/zprofile/40_zcompile @@ -10,13 +10,22 @@ if [ -n "$ZDOTDIR" ] && [ -d "$ZDOTDIR" ]; then rm -f $ZDOTDIR/**/*.zwc{,.old}(D.N) - for f ($ZDOTDIR/*(D.,@) $ZDOTDIR/**/*(.)) \ - [[ $f:t != .gitignore ]] && zcompile $f + for f in $ZDOTDIR/*(D.,@) $ZDOTDIR/**/*(.); do + case "$f:t" in + .gitignore|.*.sw?) continue;; + esac + zcompile $f + done fi if [ -n "$ZVARDIR" ] && [ -d "$ZVARDIR" ]; then rm -f $ZVARDIR/**/*.zwc{,.old}(.N) - for f ($ZVARDIR/comp*(.N)) zcompile $f + for f in $ZVARDIR/comp*(.N); do + case "$f:t" in + .gitignore|.*.sw?) continue;; + esac + zcompile $f + done fi # vim:ft=zsh diff --git a/.zsh/zshenv/.gitignore b/.zsh/zshenv/.gitignore new file mode 100644 index 0000000..53363b0 --- /dev/null +++ b/.zsh/zshenv/.gitignore @@ -0,0 +1 @@ +/parts.d diff --git a/.zsh/zshrc/.gitignore b/.zsh/zshrc/.gitignore new file mode 100644 index 0000000..53363b0 --- /dev/null +++ b/.zsh/zshrc/.gitignore @@ -0,0 +1 @@ +/parts.d diff --git a/.zsh/zshrc/00_recompile b/.zsh/zshrc/00_recompile index fabb2e5..b721072 100644 --- a/.zsh/zshrc/00_recompile +++ b/.zsh/zshrc/00_recompile @@ -8,7 +8,7 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -zrecompile $ZDOTDIR/**(N) $ZVARDIR/**(N) | while read pre file post; do +zrecompile $ZDOTDIR/**/*(/N) $ZVARDIR/**/*(/N) | while read pre file post; do case "$post" in succeeded*) rm -f "${file%:}".old;; *) :;;