forked from oanda/v20-python-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.py
executable file
·51 lines (39 loc) · 1.11 KB
/
configure.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
#!/usr/bin/env python
import common.config
import common.input
def main():
"""
Load an existing v20.conf file, update it interactively, and save it
back to a file.
"""
config = common.config.Config()
filename = common.input.get_string(
"Enter existing v20.conf filename to load",
common.config.default_config_path()
)
try:
config.load(filename)
except:
print("Config file '{}' doesn't exist, starting with defaults.".format(
filename
))
print
print("")
print("------------ Intitial v20 configuration ------------")
print(str(config))
print("----------------------------------------------------")
print("")
config.update_from_input()
print("")
print("-------------- New v20 configuration --------------")
print(str(config))
print("---------------------------------------------------")
print("")
dump = common.input.get_yn(
"Dump v20 configuration to {}?".format(filename),
True
)
if dump:
config.dump(filename)
if __name__ == "__main__":
main()