create pre-commit hook for xlint

This commit is contained in:
fanyx 2024-04-22 11:00:48 +02:00
parent 21479030d5
commit 2c947f2022
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#!/bin/bash
# xlint all changed templates
EX_ERR=1
FILES=$(git diff --name-only --staged | grep template)
for FILE in ${FILES}; do
stat "${FILE}" &> /dev/null || continue
echo "xlint ${FILE}:"
xlint $FILE || exit $EX_ERR
echo "all clear."
done