roboservant/scripts/pre-commit.sh
2020-06-06 10:24:56 -04:00

13 lines
319 B
Bash
Executable File

#!/bin/env bash
#
# Remember to link me to .git/hooks/pre-commit
set -euo pipefail
files=$((git diff --cached --name-only --diff-filter=ACMR | grep -Ei "\.hs$") || true)
if [ ! -z "${files}" ]; then
echo "$files"
echo "$files" | xargs ormolu --mode inplace
git add $(echo "$files" | paste -s -d " " -)
fi