1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-25 08:30:05 -07:00

kiss: simplify run_hook. Remove hardcoded argument count

This commit is contained in:
Dylan Araps 2021-07-14 21:20:13 +03:00
parent cd242f6d23
commit a024ef4663
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

13
kiss
View File

@ -110,20 +110,13 @@ pkg_owner() {
run_hook() {
# Run all hooks in KISS_HOOK (a colon separated
# list of absolute file paths).
_type=${1:-null} _name=${2:-null} _path=${3:-null}
IFS=:
# Intentional, globbing disabled.
# shellcheck disable=2086
set -- ${KISS_HOOK:-}
for hook in ${KISS_HOOK:-}; do case $hook in *?*)
"$hook" "$@" || die "$1 hook failed: '$hook'"
esac done
unset IFS
for hook do case $hook in *?*)
"$hook" "$_type" "$_name" "$_path" ||
die "$_name" "$_type hook failed: '$hook'"
esac done
}
run_hook_pkg() {