Skip to content

Commit

Permalink
stylish-haskell
Browse files Browse the repository at this point in the history
  • Loading branch information
coot committed Aug 22, 2024
1 parent ca5e72b commit 4242d6d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nix/check-stylish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runCommand "check-stylish" {
} ''
unpackPhase
cd $sourceRoot
bash ./scripts/ci/check-stylish.sh
bash ./scripts/ci/check-stylish.sh -g
diff -ru $src .
EXIT_CODE=$?
Expand Down
17 changes: 16 additions & 1 deletion scripts/ci/check-stylish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@ function usage {
echo " -u only check files uncommitted"
echo " -c only check files committed in HEAD"
echo " -h this help message"
echo " -g don't use git"
exit
}

export LC_ALL=C.UTF-8

STYLISH_HASKELL_ARGS="-c .stylish-haskell-network.yaml -i"
USE_GIT=1

optstring=":uch"
optstring=":uchg"
while getopts ${optstring} arg; do
case ${arg} in
h)
usage;
exit 0
;;
g)
USE_GIT=0
;;
c)
PATHS=$(git show --pretty='' --name-only HEAD)
for path in $PATHS; do
Expand All @@ -35,6 +40,9 @@ while getopts ${optstring} arg; do
fi
fi
done
if [ $USE_GIT == 1 ]; then
git --no-pager diff --exit-code
fi
exit 0
;;
u)
Expand All @@ -49,6 +57,9 @@ while getopts ${optstring} arg; do
fi
fi
done
if [ $USE_GIT == 1 ]; then
git --no-pager diff --exit-code
fi
exit 0
;;
?)
Expand All @@ -69,3 +80,7 @@ fd . './ouroboros-network-mock' $FD_OPTS
fd . './ouroboros-network-protocols' $FD_OPTS
fd . './ouroboros-network' $FD_OPTS
fd . './cardano-client' $FD_OPTS

if [ $USE_GIT == 1 ]; then
git --no-pager diff --exit-code
fi

0 comments on commit 4242d6d

Please sign in to comment.