Simplify pre-commit.

pull/9/head
Joshua Potter 2023-12-03 11:30:14 -07:00
parent 9b9e561e49
commit b4e42e6de2
1 changed files with 5 additions and 6 deletions

View File

@ -1,13 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
filesToFormat=$( FORMAT_FILES=$(
git --no-pager diff --name-status --no-color --cached | \ git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.py$/ {print $NF}' awk '$1 != "D" && $2 ~ /\.py$/ {print $NF}'
) )
for path in $filesToFormat if [ -n "$FORMAT_FILES" ]; then
do black --quiet "$FORMAT_FILES"
black --quiet "$path" git add "$FORMAT_FILES"
git add "$path" fi
done;