-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathabortable.sh
executable file
·74 lines (55 loc) · 1.28 KB
/
abortable.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
#
# List abortable tags
#
# ---------------------- Directory
ab_cd () {
ab_ghci=`which koshu-ghci.sh`
ab_dir=`dirname $ab_ghci`
ab_baala=$ab_dir/koshucode-master/baala
if [ -d $ab_baala ]; then
cd $ab_baala
else
echo "ERROR : koshucode-master directory is not found"
exit 2
fi
}
# ---------------------- List
ab_list_all () {
for d in `koshu-pkg.sh dir`; do
ab_list_in $d
done
}
ab_list_in () {(
cd $1
ab_list_for $1
)}
ab_list_for () {
for ab_hs in `find Koshucode -name '[A-Z]*.hs'`; do
ab_dir=`dirname $ab_hs`
ab_base=`basename $ab_hs`
if grep -q B.abortable $ab_hs; then
cat -n $ab_hs | sed -n \
's:^ *\([0-9]*\).*B.abortable.*"\([-a-z]*\)".*:\2 \1 '"$ab_base $ab_dir $1"':p'
fi
done
}
# ---------------------- Koshu
ab_koshu () {
ab_data
ab_script
}
ab_data () {
while read ab_tag ab_line ab_file ab_dir ab_pkg; do
echo "|-- ABORTABLE /tag '$ab_tag /pkg '$ab_pkg /line $ab_line /file \"$ab_file\" /dir \"$ab_dir\""
done
}
ab_script () {
cat <<EOF
|== ABORTABLE : source ABORTABLE /tag /pkg /dir /file /line
--table
EOF
}
# ---------------------- Main
ab_cd
ab_list_all | sort | ab_koshu | koshu -i