Simplify pre-commit.
parent
9b9e561e49
commit
b4e42e6de2
|
@ -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;
|
|
||||||
|
|
Loading…
Reference in New Issue