add pre-commit git hook (run lint)
This commit is contained in:
parent
87a4daf5c6
commit
7484584fae
2 changed files with 21 additions and 9 deletions
29
run
29
run
|
|
@ -1,16 +1,27 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
export RUN_BIN="$0"
|
RUN_BIN="$0"
|
||||||
export RUN_DIR=$(dirname "$(realpath "$0")")
|
RUN_DIR=$(dirname "$(realpath "$0")")
|
||||||
|
|
||||||
task=
|
export RUN_BIN
|
||||||
if [ -e "$RUN_DIR/scripts/$1" ]; then
|
export RUN_DIR
|
||||||
|
|
||||||
|
if [ "$(dirname "$0")" = ".git/hooks" ]; then
|
||||||
|
task=$(basename "$0")
|
||||||
|
else
|
||||||
task="$1"
|
task="$1"
|
||||||
elif [ -e "$RUN_DIR/scripts/local/$1" ]; then
|
[ $# -gt 0 ] && shift
|
||||||
task="local/$1"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$task" ] && exit 1
|
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
|
||||||
|
|
||||||
shift
|
[ -z "$script" ] && exit 1
|
||||||
exec "$RUN_DIR/scripts/$task" "$@"
|
|
||||||
|
exec "$RUN_DIR/scripts/$script" "$@"
|
||||||
|
|
|
||||||
1
scripts/git-hooks/pre-commit
Symbolic link
1
scripts/git-hooks/pre-commit
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../lint
|
||||||
Loading…
Add table
Add a link
Reference in a new issue