summaryrefslogtreecommitdiff
path: root/bin/bash_shared/functions.sh
diff options
context:
space:
mode:
authorYehonal <hw.2@hotmail.it>2016-07-08 23:58:11 +0200
committerYehonal <hw.2@hotmail.it>2016-07-08 23:58:11 +0200
commit9fd22872c0e5f52ad47f8cd002111489738b7dda (patch)
tree4df701d097ff76cc566693979994b5befed3bc8d /bin/bash_shared/functions.sh
parenteda1171939b6d7d951aef2da5b4bbb4e926c1f4a (diff)
restructured repository based on following standards:
https://github.com/HW-Core/directory-structure
Diffstat (limited to 'bin/bash_shared/functions.sh')
-rw-r--r--bin/bash_shared/functions.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/bash_shared/functions.sh b/bin/bash_shared/functions.sh
new file mode 100644
index 0000000000..6da557adea
--- /dev/null
+++ b/bin/bash_shared/functions.sh
@@ -0,0 +1,16 @@
+# par 1: hook_name
+function runHooks() {
+ hook_name="HOOKS_MAP_$1"
+ read -r -a SRCS <<< ${!hook_name}
+ echo "Running hooks: $hook_name"
+ for i in "${SRCS[@]}"
+ do
+ $i # run registered hook
+ done
+}
+
+function registerHooks() {
+ hook_name="HOOKS_MAP_$1"
+ hooks=${@:2}
+ declare -g "$hook_name+=$hooks "
+}