mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-29 07:27:59 +01:00
allow argumented options to be unargumented of at end of command line
This commit is contained in:
parent
24e0af1d94
commit
41a4a0ba9e
1 changed files with 4 additions and 3 deletions
|
@ -1230,15 +1230,16 @@ class ArgParser():
|
||||||
n = len(optqueue)
|
n = len(optqueue)
|
||||||
while i < n:
|
while i < n:
|
||||||
opt = optqueue[i]
|
opt = optqueue[i]
|
||||||
arg = argqueue[i]
|
arg = argqueue[i] if len(argqueue) > i else None
|
||||||
i += 1
|
i += 1
|
||||||
opt = self.optmap[opt][0]
|
opt = self.optmap[opt][0]
|
||||||
if (opt not in self.opts) or (self.opts[opt] is None):
|
if (opt not in self.opts) or (self.opts[opt] is None):
|
||||||
self.opts[opt] = []
|
self.opts[opt] = []
|
||||||
self.opts[opt].append(arg)
|
if len(argqueue) >= i:
|
||||||
|
self.opts[opt].append(arg)
|
||||||
|
|
||||||
for arg in self.__arguments:
|
for arg in self.__arguments:
|
||||||
if (arg[0] == VARIADIC):
|
if arg[0] == VARIADIC:
|
||||||
varopt = self.opts[arg[1][0]]
|
varopt = self.opts[arg[1][0]]
|
||||||
if varopt is not None:
|
if varopt is not None:
|
||||||
additional = ','.join(self.files).split(',') if len(self.files) > 0 else []
|
additional = ','.join(self.files).split(',') if len(self.files) > 0 else []
|
||||||
|
|
Loading…
Reference in a new issue