Mercurial > python-cmd2
changeset 172:c01f8e612a0a
\n\n finally works
author | catherine@dellzilla |
---|---|
date | Fri, 12 Dec 2008 10:14:01 -0500 |
parents | 0b93f1a4076c |
children | 10a45c030364 |
files | cmd2.py example/exampleSession.txt |
diffstat | 2 files changed, 2 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd2.py Fri Dec 12 09:54:08 2008 -0500 +++ b/cmd2.py Fri Dec 12 10:14:01 2008 -0500 @@ -387,11 +387,11 @@ if self.caseInsensitive: multilineCommand.setParseAction(lambda x: x[0].lower()) oneLineCommand.setParseAction(lambda x: x[0].lower()) - blankLineTerminator = (pyparsing.Literal('\n') + pyparsing.stringEnd)('terminator') if self.blankLinesAllowed: subparser0 = pyparsing.NoMatch else: - subparser0 = ((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') + blankLineTerminator = (pyparsing.Literal('\n') + pyparsing.stringEnd)('terminator') + subparser0 = ((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + blankLineTerminator)('statement') subparser1 = (((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') + pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip())('suffix') + afterElements) #subparser1 = (((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') +
--- a/example/exampleSession.txt Fri Dec 12 09:54:08 2008 -0500 +++ b/example/exampleSession.txt Fri Dec 12 10:14:01 2008 -0500 @@ -2,81 +2,6 @@ Calling `example.py -t` runs it as a series of unit tests, verifying that the same output is still returned. -(Cmd) help - -Documented commands (type help <topic>): -======================================== -_load edit history li load r save set shortcuts speak -ed hi l list orate run say shell show - -Undocumented commands: -====================== -EOF cmdenvironment eof exit help q quit - -(Cmd) help say -Repeats what you tell me to. -Usage: speak [options] arg - -Options: - -h, --help show this help message and exit - -p, --piglatin atinLay - -s, --shout N00B EMULATION MODE - -r REPEAT, --repeat=REPEAT - output [n] times - -(Cmd) say goodnight, Gracie -goodnight, Gracie -(Cmd) say -ps --repeat=5 goodnight, Gracie -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -(Cmd) set -prompt: (Cmd) -editor: gedit -echo: False -maxrepeats: 3 -(Cmd) set maxrepeats 5 -maxrepeats - was: 3 -now: 5 -(Cmd) say -ps --repeat=5 goodnight, Gracie -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -(Cmd) hi --------------------------[1] -help --------------------------[2] -help say --------------------------[3] -say goodnight, Gracie --------------------------[4] -say -ps --repeat=5 goodnight, Gracie --------------------------[5] -set --------------------------[6] -set maxrepeats 5 --------------------------[7] -say -ps --repeat=5 goodnight, Gracie -(Cmd) hi 3 --------------------------[3] -say goodnight, Gracie -(Cmd) history notappearinginthisfilm -(Cmd) history goodnight --------------------------[3] -say goodnight, Gracie --------------------------[4] -say -ps --repeat=5 goodnight, Gracie --------------------------[7] -say -ps --repeat=5 goodnight, Gracie -(Cmd) run 4 -say -ps --repeat=5 goodnight, Gracie -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY -OODNIGHT, GRACIEGAY (Cmd) orate four score and > seven releases ago > our BDFL