33 lines
542 B
Bash
33 lines
542 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -euo pipefail
|
||
|
|
||
|
function ls-source-files {
|
||
|
git ls-files "app/*.hs" "src/*.hs" "test/*.hs"
|
||
|
}
|
||
|
|
||
|
function check-git-status {
|
||
|
[ "$(git status -s '*.hs' | wc -l)" == "0" ]
|
||
|
}
|
||
|
|
||
|
function stylish {
|
||
|
stylish-haskell -i $(ls-source-files)
|
||
|
}
|
||
|
|
||
|
if check-git-status
|
||
|
then
|
||
|
echo "Running stylish-haskell..."
|
||
|
stylish
|
||
|
echo "Done."
|
||
|
if check-git-status
|
||
|
then
|
||
|
echo "OK, impeccable style."
|
||
|
else
|
||
|
echo "KO! Lack of style on those files:"
|
||
|
git status -sb
|
||
|
exit 1
|
||
|
fi
|
||
|
else
|
||
|
echo "git status not clean, aborting"
|
||
|
fi
|