# HG changeset patch # User catherine@cordelia # Date 1211824485 14400 # Node ID b66372883bb437bc239255b7d85c13444511758f # Parent e03a8c03ac377dbaae97195152c38978b2273a4d marked to v 0.3.3 diff -r e03a8c03ac37 -r b66372883bb4 cmd2.py --- a/cmd2.py Sun May 25 05:22:27 2008 -0400 +++ b/cmd2.py Mon May 26 13:54:45 2008 -0400 @@ -18,7 +18,7 @@ As of 0.3.0, options should be specified as `optparse` options. See README.txt. flagReader.py options are still supported for backward compatibility """ -import cmd, re, os, sys, optparse, subprocess, tempfile +import cmd, re, os, sys, optparse, subprocess, tempfile, pyparsing from optparse import make_option class OptionParser(optparse.OptionParser): @@ -175,8 +175,15 @@ result = "\n".join('%s: %s' % (sc[0], sc[1]) for sc in self.shortcuts.items()) self.stdout.write("Single-key shortcuts for other commands:\n%s\n" % (result)) + pipeFinder = pyparsing.SkipTo(pyparsing.Literal('|') ^ pyparsing.StringEnd()) + pipeFinder.ignore(pyparsing.sglQuotedString) + pipeFinder.ignore(pyparsing.dblQuotedString) + pipeFinder.ignore("--" + pyparsing.ZeroOrMore(pyparsing.CharsNotIn("\n"))) # sql-style comment + pipeFinder.ignore(pyparsing.cStyleComment) + legalFileName = re.compile(r'''^[^"'\s]+$''') def parseRedirector(self, statement, symbol, mustBeTerminated=False): + # pipeFinder.scanString(statement) parts = statement.split(symbol) if (len(parts) < 2): return statement, None @@ -212,7 +219,7 @@ return newStatement, redirect, 'r' return statement, '', '' - def onecmd(self, line): + def onecmd(self, line, assumeComplete=False): """Interpret the argument as though it had been typed in response to the prompt. @@ -224,7 +231,7 @@ """ command, args = self.extractCommand(line) statement = ' '.join([command, args]) - if command in self.multilineCommands: + if (not assumeComplete) and (command in self.multilineCommands): statement = self.finishStatement(statement) statekeeper = None stop = 0 diff -r e03a8c03ac37 -r b66372883bb4 setup.py --- a/setup.py Sun May 25 05:22:27 2008 -0400 +++ b/setup.py Mon May 26 13:54:45 2008 -0400 @@ -3,7 +3,7 @@ setup( name="cmd2", - version="0.3.2", + version="0.3.3", py_modules = ['cmd2','flagReader','bootstrap'], # metadata for upload to PyPI