anki-synonyms/.githooks/pre-commit

14 lines
228 B
Plaintext
Raw Normal View History

2022-07-03 12:50:31 +00:00
#!/usr/bin/env bash
set -e
filesToFormat=$(
git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.py/ {print $NF}'
)
for path in $filesToFormat
do
black --quiet $path
git add $path
done