Skip to content

Commit 8c02ed0

Browse files
committed
Add fourmolize script
1 parent 7cf3034 commit 8c02ed0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

scripts/fourmolize.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
if [[ $# -gt 0 ]]; then
6+
case "$1" in
7+
--changes)
8+
# Run fourmolu on changes compared to `master`.
9+
git diff --diff-filter=MA --name-only origin/master HEAD -- '*.hs'
10+
;;
11+
*)
12+
echo "Invalid option: $1" >&2
13+
exit 1
14+
;;
15+
esac
16+
else
17+
git ls-files -- '*.hs'
18+
fi \
19+
| { grep -v Setup.hs || true; } \
20+
| xargs -r fourmolu -m inplace
21+
22+
git diff --exit-code

0 commit comments

Comments
 (0)