forked from HoTT/HoTT-Agda
-
Notifications
You must be signed in to change notification settings - Fork 2
/
findpostulates
executable file
·50 lines (42 loc) · 1.06 KB
/
findpostulates
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
#!/bin/sh
if [[ $1 = "-h" ]] || [[ $1 = "--help" ]]
then
echo "Usage: $0"
echo
echo "Shows every postulate used in the Agda files present in the directory"
echo "except for HIT-related postulates, universe levels and the univalence"
echo "axiom."
exit 0
fi
if ! command -v awk &>/dev/null
then
echo "You need awk to run this script"
exit 1
fi
# Only use tput if it’s installed
TPUT="tput"
if ! tput -V &>/dev/null
then
TPUT=":"
fi
for i in $(git ls-files) $(git ls-files -o --exclude-standard)
do
if [[ $i =~ tutorial/* ]] || [[ $i =~ findpostulates ]] || [[ $i =~ old/* ]]
then
continue
fi
result=$(awk '/postulate/\
{if ($0 !~ /HIT$/ &&\
$0 !~ /Universe levels$/ &&\
$0 !~ /Coinduction$/ &&\
$0 !~ /Univalence axiom$/)\
{print; getline; print}}' $i)
if [[ $result != "" ]]
then
$TPUT setaf 5
echo $i:
$TPUT setaf 7
echo "$result"
echo
fi
done