summaryrefslogtreecommitdiff
path: root/zshrc
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-06-07 15:25:57 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-06-07 15:25:57 +0200
commit1697c66240bc9d7b85e50f500ac6704f8e69bf33 (patch)
tree2090e55a37d3e100efeb743d21aa2b0fa2ae061a /zshrc
parent89006fdc2f5ee936a4f6f025ac050dd20523c093 (diff)
[Debug] better debug managment
Diffstat (limited to 'zshrc')
-rw-r--r--zshrc18
1 files changed, 11 insertions, 7 deletions
diff --git a/zshrc b/zshrc
index 88b7d35..5061236 100644
--- a/zshrc
+++ b/zshrc
@@ -45,17 +45,21 @@ KEYCHAIN=~/.keychain/$(hostname)-sh
[ -r "${KEYCHAIN}-gpg" ] && source ${KEYCHAIN}-gpg
-DEBUG=${DEBUG:-no}
+__debug ()
+{
+ [ -n "$DEBUG" ] && echo >&2 $@
+}
export USER HOST DOMAIN UID
if [ -d $ZDOTDIR ]; then
+
for script in $ZDOTDIR/??_*.zsh
do
- [ "$DEBUG" = "yes" ] && echo -n "${${script:t:r}/??_/}... "
+ __debug -n "${${script:t:r}/??_/}... "
source $script
- [ "$DEBUG" = "yes" ] && echo
+ __debug
for i in "net:$DOMAIN"\
"host:$HOST"\
@@ -82,15 +86,15 @@ if [ -d $ZDOTDIR ]; then
specific_script=${script:h}/$i/${${script:t}/??_/}
if test -f $specific_script
then
- [ "$DEBUG" = "yes" ] && echo -n "$i/${${specific_script:t:r}/??_/}... ";
+ __debug -n "$i/${${specific_script:t:r}/??_/}... ";
source $specific_script
- [ "$DEBUG" = "yes" ] && echo
+ __debug
fi
if test -f $specific_script.gpg
then
- [ "$DEBUG" = "yes" ] && echo -n "$i/${${specific_script:t:r}/??_/} [CRYPTED]... ";
+ __debug -n "$i/${${specific_script:t:r}/??_/} [CRYPTED]... ";
eval $(gpg --quiet --decrypt $specific_script.gpg)
- [ "$DEBUG" = "yes" ] && echo
+ __debug
fi
done
done