diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2022-12-05 01:39:05 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2022-12-05 01:39:05 +0100 |
commit | e9f52f24c29f798d618c6e8e68ceabbd86bd0c6c (patch) | |
tree | 95f88e910ec3388d82c5e3814f0c2cb6f6c4b49c /lib/hooks.sh | |
parent | 05280ce5c09fea7f9e9bdddb69e3d21b8debe088 (diff) | |
download | dotfiles-e9f52f24c29f798d618c6e8e68ceabbd86bd0c6c.tar.gz |
hooks!
Diffstat (limited to 'lib/hooks.sh')
-rw-r--r-- | lib/hooks.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/hooks.sh b/lib/hooks.sh new file mode 100644 index 0000000..8d5fc1d --- /dev/null +++ b/lib/hooks.sh @@ -0,0 +1,18 @@ +# Functions for hooks + +# 1: Name of hook +call_hook() { + if [ ! -x "hooks/$1.hook" ]; then + debug "$1.hook was not found. Skipping." + return + fi + + debug "Running hook $1" + + hooks/$1.hook 2>&1 | (while read line; do echo [hook: $1] $line; done) + RET=${PIPESTATUS[0]} + + if [ $RET -ne 0 ]; then + warning "Hook $1 exitet with code $RET" + fi +} |