Commit 07d5efe5 authored by ulrich_y's avatar ulrich_y
Browse files

Better handling of defaults

parent 808b7b60
......@@ -194,9 +194,13 @@ def interogate(args={}):
defaults = dict(zip(specs.args, specs.defaults))
def basic_ask(msg, default, parser=(lambda x: x)):
if type(default) == list:
default = ", ".join(str(i) for i in default)
else:
default = str(default)
ans = input("%s? [%s] " % (msg, default))
if ans == '':
return default
return parser(default)
else:
return parser(ans)
......@@ -226,7 +230,7 @@ def interogate(args={}):
for piece in pieces:
args['stats'][piece] = basic_ask(
"How much statistics for " + piece + " (pc, pi, c, i)",
(10000, 20, 100000, 100),
['10M', '20', '100M', '100'],
parser=lambda x: tuple(parsestat(i) for i in x.split(','))
)
return args
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment