# HG changeset patch # User catherine@cordelia # Date 1210887495 14400 # Node ID c8efa4369189af815ec8b96de8d9a64d07b0dc24 # Parent 1899088dd95d1eefae6f28e374d208ba7de0180d fixes to option parsing diff -r 1899088dd95d -r c8efa4369189 cmd2.py --- a/cmd2.py Thu May 15 13:44:48 2008 -0400 +++ b/cmd2.py Thu May 15 17:38:15 2008 -0400 @@ -45,8 +45,11 @@ optionParser.set_usage("%s [options] arg" % func.__name__.strip('do_')) def newFunc(instance, arg): try: - opts, arg = optionParser.parse_args(arg.split()) - except optparse.OptionValueError, e: + opts, arg = optionParser.parse_args(arg.split()) + arg = ' '.join(arg) + except (optparse.OptionValueError, optparse.BadOptionError, + optparse.OptionError, optparse.AmbiguousOptionError, + optparse.OptionConflictError), e: print e optionParser.print_help() return