forked from Git-Commit-Show/gcs-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcs.sh
executable file
·167 lines (162 loc) · 3.52 KB
/
gcs.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/bin/bash
trap '' 2
getData(){
var='https://github.com/Git-Commit-Show/'$1'/tree/master/2020'
if [ -f html.txt ]
then
rm html.txt
rm imdt.txt
rm imdt1.txt
rm final.txt
fi
curl -sS $var -o html.txt
filter1='<\s*a class="js-navigation-open "[^>]*>(.*?)<\s*/\s*a>'
filter2='>(.*?)<'
file=$(grep -oP '<\s*a class="js-navigation-open "[^>]*>(.*?)<\s*/\s*a>' html.txt)
echo $file > imdt.txt
final=$(grep -oP '>(.*?)<' imdt.txt )
echo $final > imdt1.txt
o="$(tr -cs 'a-zA-Z0-9\.' '\n' < imdt1.txt)"
echo "$o" > final.txt
}
getIndiData(){
if [ -f $1 ]
then
rm $1
rm file.html
fi
curl -sS -O https://raw.githubusercontent.com/Git-Commit-Show/volunteers/master/2020/$1;
awkdown $1 > file.html;
html2text file.html;
}
while true
do
clear
echo "============================"
echo "Menu ----"
echo "============================"
echo "Type volunteer to list volunteers."
echo "Type speaker to list speakers."
echo "Type stream to stream the Master Class"
echo "Type Glimpse to See what GCS 2019 was like"
echo "Type Schedule to See the Schedule of GCS-20"
echo "Type countdown to show a timer"
echo "Type q to list exit."
echo -e "\n"
echo -e "Enter your choice \c"
read option
case "$option" in
v | volunteer)while true
do
echo "Listing Volunteers.";
getData volunteers
input="final.txt"
count=1
while IFS= read -r line
do
if [ ${#line} \> 0 ]
then
line=${line%???}
echo "$count. $line"
count=$((count+1))
fi
done < "$input"
echo "Type b to go back";
echo -e "Enter your choice \c";
read val
case "$val" in
b ) break ;;
* )
if [ ${#val} = 1 ]
then
count=1
val=$((val+1))
vname=0
while IFS= read -r line
do
if [ $count = $val ]
then
vname=$line
break
fi
count=$((count+1))
done < "$input"
echo $vname
getIndiData $vname
else
new='$val.md'
echo $new
getIndiData $new
fi
rm file.html
rm imdt.txt
rm imdt1.txt
rm html.txt
;;
esac
echo -e "Enter return to continue \c"
read input
done
;;
speaker | s)while true
do
clear
echo "Listing Speakers.";
getData speakers
input="final.txt"
count=1
while IFS= read -r line
do
if [ ${#line} \> 0 ]
then
line=${line%???}
echo "$count. $line"
count=$((count+1))
fi
done < "$input"
echo "Type b to go back";
echo -e "Enter your choice \c";
read val
case "$val" in
b ) break ;;
* )
if [ ${#val} = 1 ]
then
count=1
val=$((val+1))
vname=0
while IFS= read -r line
do
if [ $count = $val ]
then
vname=$line
break
fi
count=$((count+1))
done < "$input"
echo $vname
getIndiData $vname
else
new='$val.md'
echo $new
getIndiData $new
fi
rm file.html
rm imdt.txt
rm imdt1.txt
rm html.txt
;;
esac
echo -e "Enter return to continue \c"
read input
done
;;
stream |s) echo "STreams a videos";
;;
schedule | sc) echo "Prints the Schedule";
;;
q) exit;;
esac
echo -e "Enter return to continue \c"
read input
done