forked from IntersectMBO/cardano-ledger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathghcid
executable file
·48 lines (38 loc) · 1008 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -euC
SNAME=cardano-ledger-ghcid
PACKAGES=(
semantics/executable-spec
semantics/small-steps-test
shelley/chain-and-ledger/executable-spec
shelley/chain-and-ledger/shelley-spec-ledger-test
shelley-ma/impl
shelley-ma/shelley-ma-test
)
ghcid_for_package () {
local wd="$(pwd)/$1"
PACKAGE_NAME=$(get_package_name $wd | xargs basename | sed -e "s/.cabal//")
echo $PACKAGE_NAME
tmux new-window -d -t "=$SNAME" -n $PACKAGE_NAME -c "$wd"
tmux send-keys -t "=$SNAME:=$PACKAGE_NAME" 'ghcid' Enter
}
# Get the package name for a given directory
get_package_name () {
CABAL_FILE=$(find $1 -maxdepth 1 -name "*.cabal")
echo $CABAL_FILE
}
att() {
[ -n "${TMUX:-}" ] &&
tmux switch-client -t "=$SNAME" ||
tmux attach-session -t "=$SNAME"
}
if tmux has-session -t "=$SNAME" 2> /dev/null; then
att
exit 0
fi
tmux new-session -d -s $SNAME
tmux rename-window -t "=$SNAME:0" "cls"
for t in ${PACKAGES[@]}; do
ghcid_for_package $t
done
att