diff options
author | Næþ'n Lasseter <Næþ'n Lasseter nathan@bytemark.co.uk> | 2016-08-25 14:22:29 +0100 |
---|---|---|
committer | Næþ'n Lasseter <Næþ'n Lasseter nathan@bytemark.co.uk> | 2016-08-25 14:22:29 +0100 |
commit | be45dcad9491e809d13145baab5e6ea1caf80791 (patch) | |
tree | 7144a6ca8f90c37a600f050e6ad48d535535186e /rc |
Initial Commit
Diffstat (limited to 'rc')
-rw-r--r-- | rc | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +### +### cdhooks +### OH DEAR GOD WHAT WAS I THINKING +### + +function cd { + if [ $CDHOOKS_VERBOSE ]; then + VERBOSE=--verbose + fi + + if [ "x$1" == "x" -o "x$1" == "x-" -o -d "$1" ]; then + + # Outgoing stuff + [ -d "$HOME/.cdhooks/outgoing/pre-local" ] && run-parts $VERBOSE $HOME/.cdhooks/outgoing/pre-local + [ -d ".cdhooks/outgoing" ] && run-parts $VERBOSE .cdhooks/outgoing + [ -d "$HOME/.cdhooks/outgoing/post-local" ] && run-parts $VERBOSE $HOME/.cdhooks/outgoing/post-local + + # cd + if [ "x" == "x$*" ] + then + builtin cd + else + builtin cd "$*" + fi + + # Incoming stuff + [ -d "$HOME/.cdhooks/incoming/pre-local" ] && run-parts $VERBOSE $HOME/.cdhooks/incoming/pre-local + [ -d ".cdhooks/incoming" ] && run-parts $VERBOSE .cdhooks/incoming + [ -d "$HOME/.cdhooks/incoming/post-local" ] && run-parts $VERBOSE $HOME/.cdhooks/incoming/post-local + + else + + echo "[cdhooks] No such directory: $1" + + fi +} |