-
Notifications
You must be signed in to change notification settings - Fork 2
/
show
57 lines (50 loc) · 1.05 KB
/
show
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
#!/usr/bin/env python
import sys
license = open('LICENSE')
flag = False
def notice():
print 'Command Error.\nUsage:\n show c Show Conditions\n show w Show No Warranty'
quit()
def showc():
global flag
for i in license:
if i[0:4] == ' 2.':
flag = True
print '\n'
print ' Conditions:'
if flag == True and i[0:4] == ' ':
if i[4:7] in ['a) ', 'b) ', 'c) ']:
print '\n'
print i[4:-1],
if i[0:4] == ' 3.':
flag = False
def showw():
global flag
for i in license:
if i[-14:-1] == ' NO WARRANTY':
flag = True
print '\n'
if i[-28:-1] == 'END OF TERMS AND CONDITIONS':
flag = False
if flag == True:
if i[0:6] == ' 11. ':
i = i[0:2] + i[3:]
print '\n'
if i[0:6] == ' 12. ':
i = i[0:2] + i[3:]
print '\n'
print i[:-1],
def main():
if len(sys.argv) != 2:
notice()
elif sys.argv[1] == 'c' or sys.argv[1] == 'C':
showc()
elif sys.argv[1] == 'w' or sys.argv[1] == 'W':
showw()
else:
notice()
if __name__ == "__main__":
try:
main()
finally:
pass