nvim/.githooks/pre-commit

8 lines
209 B
Bash
Executable file

#!/usr/bin/env bash
LUA_FILES=$(git diff --cached --name-only --diff-filter=AM | grep '\.lua$')
if [ -n "$LUA_FILES" ]; then
echo "$LUA_FILES" | xargs "$STYLUA_PATH"
echo "$LUA_FILES" | xargs git add
fi