mirror of
https://github.com/bol-van/zapret.git
synced 2025-08-10 01:02:03 +03:00
Truncated history
This commit is contained in:
25
common/custom.sh
Normal file
25
common/custom.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user