Verified Commit 631f5dd4 authored by mathieui's avatar mathieui

Allow -1 as a value for optional arguments in the args parser to collect an...

Allow -1 as a value for optional arguments in the args parser to collect an unspecified number of items
parent 561c46f1
......@@ -120,7 +120,11 @@ class CommandArgParser(object):
if len(args) < mandatory:
return func(self, None, *a, **kw)
res, args = args[:mandatory], args[mandatory:]
opt_args = args[:optional]
if optional == -1:
opt_args = args[:]
else:
opt_args = args[:optional]
if opt_args:
res += opt_args
args = args[len(opt_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