# HG changeset patch # User catherine@dellzilla # Date 1228147649 18000 # Node ID 5a94501b6b937d02fef223f3bd856da6c40f2677 # Parent 87d3f3203b960a3920ce062a7c60172193be5dcc fix new bug in argument parsing diff -r 87d3f3203b96 -r 5a94501b6b93 cmd2.py --- a/cmd2.py Mon Dec 01 01:34:05 2008 -0500 +++ b/cmd2.py Mon Dec 01 11:07:29 2008 -0500 @@ -52,7 +52,7 @@ def newFunc(instance, arg): try: opts, newArgs = optionParser.parse_args(arg.split()) - arg.parsed['args'] = arg[arg.find(newArgs[0]):] + newArgs = arg[arg.find(newArgs[0]):] except (optparse.OptionValueError, optparse.BadOptionError, optparse.OptionError, optparse.AmbiguousOptionError, optparse.OptionConflictError), e: @@ -61,8 +61,9 @@ return if hasattr(opts, '_exit'): return None + arg = arg.parser('%s %s' % (arg.parsed.command, newArgs)) result = func(instance, arg, opts) - return result + return result newFunc.__doc__ = '%s\n%s' % (func.__doc__, optionParser.format_help()) return newFunc return option_setup @@ -137,6 +138,7 @@ writeToPasteBuffer = getPasteBuffer pyparsing.ParserElement.setDefaultWhitespaceChars(' \t') +''' def parseSearchResults(pattern, s): generator = pattern.scanString(s) try: @@ -147,7 +149,7 @@ result = pyparsing.ParseResults('') result['before'] = s return result - +''' def replaceInput(source): if source: @@ -420,6 +422,7 @@ result['suffix'] = useTerminatorFrom.parsed.suffix p = ParsedString(result.args) p.parsed = result + p.parser = self.parsed return p def onecmd(self, line, assumeComplete=False):