Mercurial > python-cmd2
changeset 37:a974e2f44cbe
made redirectors work with app-specific StatementEndPattern
author | catherine@localhost |
---|---|
date | Mon, 19 May 2008 15:23:42 -0400 |
parents | f472921d6189 |
children | 6d715d7a04fd |
files | cmd2.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd2.py Mon May 19 13:56:00 2008 -0400 +++ b/cmd2.py Mon May 19 15:23:42 2008 -0400 @@ -46,13 +46,14 @@ def newFunc(instance, arg): try: 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 - result = func(instance, ' '.join(arg), opts) + result = func(instance, arg, opts) return result newFunc.__doc__ = '%s\n%s' % (func.__doc__, optionParser.format_help()) return newFunc @@ -177,7 +178,7 @@ parts = statement.split(symbol) if (len(parts) < 2): return statement, None - if mustBeTerminated and (parts[-2].strip()[-1] not in self.terminators): + if mustBeTerminated and (not self.statementEndPattern.search(parts[-2])): return statement, None (newStatement, redirect) = (symbol.join(parts[:-1]), parts[-1].strip()) if redirect: