testcontainers-clj/script/pre-commit
2020-08-08 18:19:37 -07:00

19 lines
363 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
if [[ -z "$FILES" ]]; then
exit 0
fi
echo "Fixing Clojure style..."
# Format all selected files
echo "$FILES" | xargs lein cljstyle fix --report
# Add back the modified/prettified files to staging
echo "$FILES" | xargs git add
echo "Done!"