testcontainers-clj/script/pre-commit
Rob Hanlon 36f3820f4f
cljstyle redux, with pre-commit hook (#24)
* cljstyle redux, with pre-commit

* Use fork of lein-githooks with fixes for shell characters

* Remove stale doc
2020-08-09 21:38:20 +02:00

21 lines
403 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
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!"