From: W. Trevor King Date: Thu, 8 Sep 2011 03:24:18 +0000 (-0400) Subject: Fixed #/bc1e6ff4# (extra argument crash). X-Git-Tag: 1.1.0~175^2~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e7da79e665798ddd411ab89134ec8c6cf9ff0e58;p=be.git Fixed #/bc1e6ff4# (extra argument crash). --- diff --git a/.be/bea86499-824e-4e77-b085-2d581fa9ccab/bugs/bc1e6ff4-478f-4afe-b2a1-86e25ee448b7/values b/.be/bea86499-824e-4e77-b085-2d581fa9ccab/bugs/bc1e6ff4-478f-4afe-b2a1-86e25ee448b7/values index 71ed832..d06c54c 100644 --- a/.be/bea86499-824e-4e77-b085-2d581fa9ccab/bugs/bc1e6ff4-478f-4afe-b2a1-86e25ee448b7/values +++ b/.be/bea86499-824e-4e77-b085-2d581fa9ccab/bugs/bc1e6ff4-478f-4afe-b2a1-86e25ee448b7/values @@ -7,7 +7,7 @@ reporter: Tanguy LE CARROUR severity: minor -status: open +status: fixed summary: Crashes when too many arguments are provided diff --git a/libbe/ui/command_line.py b/libbe/ui/command_line.py index d5719a6..f579a19 100644 --- a/libbe/ui/command_line.py +++ b/libbe/ui/command_line.py @@ -133,8 +133,9 @@ class CmdOptionParser(optparse.OptionParser): else: value = self.process_raw_argument(argument=argument, value=arg) parsed_args[i] = value - if len(parsed_args) > len(self.command.args) \ - and self.command.args[-1].repeatable == False: + if (len(parsed_args) > len(self.command.args) and + (len(self.command.args) == 0 or + self.command.args[-1].repeatable == False)): raise libbe.command.UserError('Too many arguments') for arg in self.command.args[len(parsed_args):]: if arg.optional == False: