bootstrap/specs/poetry/template/.githooks/pre-commit

12 lines
210 B
Bash

#!/usr/bin/env bash
set -e
FORMAT_FILES=$(
git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.py$/ {print $NF}'
)
black --quiet "$FORMAT_FILES"
git add "$FORMAT_FILES"