2021-06-06 14:58:50 +02:00
|
|
|
#! /usr/bin/env nix-shell
|
|
|
|
#! nix-shell -i sh -p python38
|
2022-04-12 16:42:52 +02:00
|
|
|
|
|
|
|
# SPDX-FileCopyrightText: 2021 Leroy Hopson
|
|
|
|
# SPDX-License-Identifier: CC0-1.0
|
|
|
|
|
2021-06-19 13:01:08 +02:00
|
|
|
set -e
|
2021-06-06 14:58:50 +02:00
|
|
|
|
2022-08-26 05:42:13 +02:00
|
|
|
GDTOOLKIT_VERSION=c514a022f7e566f06a0c68058727737fe0d8b33c
|
2021-06-06 14:58:50 +02:00
|
|
|
|
2021-07-02 18:54:36 +02:00
|
|
|
FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep '\.gd$' | grep -v '^addons/gd-plug' | grep -v '^addons/gut' | sed 's| |\\ |g')
|
|
|
|
echo $FILES
|
2021-06-06 14:58:50 +02:00
|
|
|
[ -z "$FILES" ] && exit 0
|
|
|
|
|
|
|
|
# Setup GDScript Toolkit.
|
|
|
|
if [ ! -f .venv/bin/activate ] || ! source .venv/bin/activate; then
|
|
|
|
python -m venv .venv && source .venv/bin/activate;
|
|
|
|
fi
|
|
|
|
if ! gdformat --version; then
|
2022-04-12 16:42:52 +02:00
|
|
|
pip install git+https://github.com/Scony/godot-gdscript-toolkit@${GDTOOLKIT_VERSION};
|
2021-06-06 14:58:50 +02:00
|
|
|
fi
|
|
|
|
|
2022-04-12 16:42:52 +02:00
|
|
|
# Lint all selected files.
|
|
|
|
echo "$FILES" | xargs gdformat --check
|
2021-06-06 14:58:50 +02:00
|
|
|
|
|
|
|
exit 0
|