blob: 5334d9441cd345176d2cbc7d7bbf8c22d37b68c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
}
|