forked from hqwrong/game-robot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcfg.py
24 lines (19 loc) · 816 Bytes
/
cfg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import argparse,sys
Config = {}
def parse_args():
parser = argparse.ArgumentParser(description = "New game robot")
parser.add_argument('-s', '--server', dest = 'host',
help = 'game server ip address')
parser.add_argument('-p', '--port', type=int, dest = 'port',
help = 'game server tcp port')
parser.add_argument('-u', '--uid', dest = 'uid', help="login as UID")
parser.add_argument("-m", '--mode', dest = "mode", choices = ["simulator", "client"])
parser.add_argument(dest="config", help = "config file")
args = parser.parse_args()
if args.config:
execfile(args.config, Config)
del args.config
for k,v in vars(args).iteritems():
if v:
Config[k] = v
sys.path.insert(0, Config["proto_path"])