-
Notifications
You must be signed in to change notification settings - Fork 1
/
chessreader.py
56 lines (35 loc) · 1.22 KB
/
chessreader.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
46
47
48
49
50
51
52
53
54
55
'''chessreader init module '''
import argparse
import sys
import colorama
import tests, utils, core
################################################################################
ARG_MAIN_HELP = ''
ARG_TEST_HELP = \
'Launch the test suite of Chessreader; all other arguments are ignored'
ARG_DEBUG_HELP = \
'Display debugging messages to stdout'
PARSED_ARGS = None
def parse_arguments():
'''Parse command-line arguments and return the parsed output'''
parser = argparse.ArgumentParser(description=ARG_MAIN_HELP)
parser.add_argument('--test', help=ARG_TEST_HELP, action="store_true")
parser.add_argument('-d', '--debug', help=ARG_DEBUG_HELP,
action="store_true")
return parser.parse_args()
################################################################################
def main():
'''Launch function'''
colorama.init()
utils.log.do_show_debug_messages = PARSED_ARGS.debug
# Launch test suite?
if PARSED_ARGS.test:
log.info("running chessreader test base")
tests.run()
sys.exit(0)
# default: call the shell
core.Shell().cmdloop()
sys.exit(0)
if __name__ == '__main__':
PARSED_ARGS = parse_arguments()
main()