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
|
||||
|
||||
export RUN_BIN="$0"
|
||||
export RUN_DIR=$(dirname "$(realpath "$0")")
|
||||
RUN_BIN="$0"
|
||||
RUN_DIR=$(dirname "$(realpath "$0")")
|
||||
|
||||
task=
|
||||
if [ -e "$RUN_DIR/scripts/$1" ]; then
|
||||
export RUN_BIN
|
||||
export RUN_DIR
|
||||
|
||||
if [ "$(dirname "$0")" = ".git/hooks" ]; then
|
||||
task=$(basename "$0")
|
||||
else
|
||||
task="$1"
|
||||
elif [ -e "$RUN_DIR/scripts/local/$1" ]; then
|
||||
task="local/$1"
|
||||
[ $# -gt 0 ] && shift
|
||||
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
|
||||
exec "$RUN_DIR/scripts/$task" "$@"
|
||||
[ -z "$script" ] && exit 1
|
||||
|
||||
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