From 41a4a0ba9ee18f6daa91452ef9eb107dff57c7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Mon, 29 Oct 2012 20:29:25 +0100 Subject: [PATCH] allow argumented options to be unargumented of at end of command line --- ponysay.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ponysay.py b/ponysay.py index 049b6420..87925a46 100755 --- a/ponysay.py +++ b/ponysay.py @@ -1230,15 +1230,16 @@ class ArgParser(): n = len(optqueue) while i < n: opt = optqueue[i] - arg = argqueue[i] + arg = argqueue[i] if len(argqueue) > i else None i += 1 opt = self.optmap[opt][0] if (opt not in self.opts) or (self.opts[opt] is None): self.opts[opt] = [] - self.opts[opt].append(arg) + if len(argqueue) >= i: + self.opts[opt].append(arg) for arg in self.__arguments: - if (arg[0] == VARIADIC): + if arg[0] == VARIADIC: varopt = self.opts[arg[1][0]] if varopt is not None: additional = ','.join(self.files).split(',') if len(self.files) > 0 else []