-
Notifications
You must be signed in to change notification settings - Fork 11
/
building.py
45 lines (36 loc) · 967 Bytes
/
building.py
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
import sys
import gen
import mgr
import os
argv = sys.argv
class Building(object):
def __init__(self):
self.rainbow = gen.GeneratedRainbowCoder()
self.cmd_instruct = {
"building_all":
lambda: self.rainbow.building_all(),
"building_index":
lambda: self.rainbow.building_index_md(),
"building_update":
lambda: self.rainbow.building_update(),
"building_post":
lambda: self.rainbow.building_post(argv[2]),
"building_rss":
lambda: os.system("lua rss.lua"),
}
def use_page(self):
cmd = ""
for (k, v) in self.cmd_instruct.items():
cmd += " " + k + "\n"
print('use_page: \n python cmd.py <cmd>\n cmd list:\n' + cmd)
exit()
def run(self, cmd):
if not self.cmd_instruct.has_key(cmd):
self.use_page()
else:
func = self.cmd_instruct[cmd]
func()
building = Building()
if len(argv) < 2:
building.use_page()
building.run(argv[1])