27 lines
511 B
Bash
Executable file
27 lines
511 B
Bash
Executable file
#!/bin/sh -e
|
|
|
|
RUN_BIN="$0"
|
|
RUN_DIR=$(dirname "$(realpath "$0")")
|
|
|
|
export RUN_BIN
|
|
export RUN_DIR
|
|
|
|
if [ "$(dirname "$0")" = ".git/hooks" ]; then
|
|
task=$(basename "$0")
|
|
else
|
|
task="$1"
|
|
[ $# -gt 0 ] && shift
|
|
fi
|
|
|
|
script=
|
|
if [ -x "$RUN_DIR/scripts/local/$task" ]; then
|
|
script="local/$task"
|
|
elif [ -x "$RUN_DIR/scripts/git-hooks/$task" ]; then
|
|
script="git-hooks/$task"
|
|
elif [ -x "$RUN_DIR/scripts/$task" ]; then
|
|
script="$task"
|
|
fi
|
|
|
|
[ -z "$script" ] && exit 1
|
|
|
|
exec "$RUN_DIR/scripts/$script" "$@"
|