Simplify pre-commit.
parent
9b9e561e49
commit
b4e42e6de2
|
@ -1,13 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
filesToFormat=$(
|
||||
FORMAT_FILES=$(
|
||||
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;
|
||||
if [ -n "$FORMAT_FILES" ]; then
|
||||
black --quiet "$FORMAT_FILES"
|
||||
git add "$FORMAT_FILES"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue