ZealOS/meta/pre-commit
xSlendiX 06a79a1a06
Add pre-commit hook to remove cursors.
This patch adds a pre-commit hook specifically for *NIX systems to
remove the cursor byte from all files under `src/`.

The reason why I chose python is because it is assumed that most *NIX
systems already come with it pre-installed.

Signed-off-by: xSlendiX <slendi@socopon.com>
2023-02-26 03:33:48 +02:00

25 lines
469 B
Bash
Executable file

#!/bin/sh
set -e
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "${script_path}/.." || exit 1
pwd | grep -q '.git' && cd ..
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
FAILURES=0
set +e
echo "Running meta/check_code.sh"
if time meta/check_code.sh "$@" && git diff --exit-code; then
echo -e "[${GREEN}GOOD${NC}]: meta/check_code.sh"
else
echo -e "[${RED}FAIL${NC}]: meta/check_code.sh"
((FAILURES+=1))
fi
exit "${FAILURES}"