]> git.donarmstrong.com Git - zsh.git/blob - .zsh/sourcedir
Merge branch 'master' of ssh://git.madduck.net/~/git/pub/etc/zsh
[zsh.git] / .zsh / sourcedir
1 # sourcedir
2 #
3 # Defines helper function to source files in a directory
4 #
5 # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
6 # Released under the terms of the Artistic Licence 2.0
7 #
8 # Source repository: http://git.madduck.net/v/etc/zsh.git
9 #
10
11 . $ZDOTDIR/logging
12
13 sourcedir() {
14   if [ ! -d "$1" ]; then
15     error "no such directory: $1"
16     return 1
17   fi
18 #  debug "sourcing directory ${1#$ZDOTDIR/}"
19   for f in "$1"/*(.N); do
20     case "$f" in
21       *~|*.bak|*.old|*.sw?|*.zwc|*.disabled) continue;;
22     esac
23 #    debug "  sourcing file $f"
24     source "$f"
25   done
26 }
27
28 # vim:ft=zsh