mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-22 06:15:25 +00:00
26 lines
432 B
Bash
26 lines
432 B
Bash
|
custom_runner()
|
||
|
{
|
||
|
# $1 - function name
|
||
|
# $2+ - params
|
||
|
|
||
|
local n script FUNC=$1
|
||
|
|
||
|
shift
|
||
|
|
||
|
[ -f "$CUSTOM_DIR/custom" ] && {
|
||
|
unset -f $FUNC
|
||
|
. "$CUSTOM_DIR/custom"
|
||
|
existf $FUNC && $FUNC "$@"
|
||
|
}
|
||
|
[ -d "$CUSTOM_DIR/custom.d" ] && {
|
||
|
n=$(ls "$CUSTOM_DIR/custom.d" | wc -c | xargs)
|
||
|
[ "$n" = 0 ] || {
|
||
|
for script in "$CUSTOM_DIR/custom.d/"*; do
|
||
|
unset -f $FUNC
|
||
|
. "$script"
|
||
|
existf $FUNC && $FUNC "$@"
|
||
|
done
|
||
|
}
|
||
|
}
|
||
|
}
|