-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathincept
executable file
·62 lines (53 loc) · 1.81 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
56
57
58
59
60
61
#!/usr/bin/env python
import sys, time
from inception.argparsers.bootstrap import BootstrapArgParser
from inception.argparsers.learn import LearnArgParser
from inception.argparsers.plant import PlantArgParser
from inception.argparsers.sync import SyncArgParser
from inception.argparsers.autoroot import AutorootArgParser
from inception.argparsers.make import MakeArgParser
from inception.argparsers.ls import LsArgParser
from inception.argparsers.busybox import BusyboxArgParser
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)