-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.py
43 lines (40 loc) · 880 Bytes
/
run.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
import argparse
import sys
import unittest
from codetype import identify
from dev import run
parser = argparse.ArgumentParser()
parser.add_argument(
"script",
nargs=1,
help="dev|test"
)
parser.add_argument(
"-t",
"--test",
action="store_true"
)
parser.add_argument(
"lang",
nargs="?"
)
parser.add_argument(
"-v",
"--verbose",
action="store_true",
help="Return all scores."
)
args = vars(parser.parse_args())
script = args["script"][0]
if script == "dev":
if args["test"]:
run(lang=args["lang"], is_test=1)
elif args["lang"]:
run(lang=args["lang"], is_test=0)
elif script == "test":
unittest.TextTestRunner().run(unittest.TestLoader().discover("."))
elif script == "codetype":
print(identify(args["lang"], verbose=args["verbose"]))
else:
print("{0} not recognized!".format(script))
sys.exit(0)