template-godot4/.githooks/pre-commit

32 lines
676 B
Plaintext
Raw Permalink Normal View History

2024-07-18 01:15:16 +00:00
#!/bin/sh
GDFORMAT=gdformat
GDLINT=gdlint
VENV=.venv
PYTHON=python3
PIP=$VENV/bin/pip
if ! which $GDFORMAT &> /dev/null; then
if ! test -f $VENV/bin/$GDFORMAT; then
if ! which $PYTHON &> /dev/null; then
echo "Please install Python 3"
exit 1
fi
echo "gdscript-toolkit will be installed locally under $VENV."
echo "this only needs to be performed once."
echo "creating venv..."
$PYTHON -m venv $VENV
echo "installing gdscript-toolkit..."
$PIP install -r requirements.txt
fi
GDFORMAT=$VENV/bin/$GDFORMAT
GDLINT=$VENV/bin/$GDLINT
fi
set -x
$GDFORMAT --check .
$GDLINT .