forked from tgalal/inception
-
Notifications
You must be signed in to change notification settings - Fork 0
/
incept
executable file
·56 lines (48 loc) · 1.54 KB
/
incept
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
#!/usr/bin/env python
import sys, time
from inception.argparsers import BootstrapArgParser,PlantArgParser,\
LearnArgParser, SyncArgParser, AutorootArgParser,\
BusyboxArgParser, LsArgParser, MakeArgParser
from inception.argparsers.exceptions import InceptionArgParserException
from inception import __version__
import logging
logging.basicConfig(level = logging.DEBUG)
if __name__ == "__main__":
args = sys.argv
if(len(args) > 1):
del args[0]
modeDict = {
"bootstrap": BootstrapArgParser,
#"bootstrap2": BootstrapCommandParser2,
"make": MakeArgParser,
"plant": PlantArgParser,
"learn": LearnArgParser,
"sync": SyncArgParser,
"autoroot": AutorootArgParser,
"busybox": BusyboxArgParser,
"ls": LsArgParser,
"version": None
}
if(len(args) == 0 or args[0] not in modeDict):
print("Available commands:\n===================")
print(", ".join(modeDict.keys()))
sys.exit(1)
mode = args[0]
if mode == "version":
print(__version__)
sys.exit(0)
parser = modeDict[mode]()
#args = vars(parser.parse_args())
#if len(sys.argv) == 1:
try:
start = int(time.time())
if not parser.process():
parser.print_help()
else:
end = int(time.time())
elapsed = end - start
if parser.trackTime():
print("Finished in %s seconds" % elapsed)
except InceptionArgParserException as e:
print("ERROR!!\n%s" % e)
sys.exit(1)