-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathghcid
executable file
·30 lines (25 loc) · 848 Bytes
/
ghcid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env -S nix develop -L -c zsh
set -e
set -u
set -o pipefail
readonly target=${1:-lib:quasar}
readonly executable=${2:-}
if [[ -n $executable ]]
then
run_executable="cabal run --disable-optimisation --ghc-option -fdiagnostics-color=always $executable"
else
run_executable=true
fi
print -P %F{yellow}Cleaning repository%f
cabal clean
(git ls-files 'cabal.project' '*/*.cabal' 'flake.*' '*/test/*' '*.hs-boot') | \
entr -r \
nix develop -L -c \
ghcid \
--warnings \
"--command=cabal repl --disable-optimisation --ghc-option -fdiagnostics-color=always $target" \
"--test=:! \
cabal test --disable-optimisation --test-show-details=direct --ghc-option -fdiagnostics-color=always && \
$run_executable && \
zsh -c 'print -P %F{green}Build and tests passed%f' \
"