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
1 changed files with 3 additions and 10 deletions

13
kiss
View File

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