Mercurial > python-cmd2
changeset 182:1c21db096f49
switched literal newline to lineEnd
author | catherine@Elli.myhome.westell.com |
---|---|
date | Thu, 15 Jan 2009 19:38:07 -0500 |
parents | 24eff658997b |
children | 403e1c3ffc4a |
files | cmd2.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd2.py Wed Dec 24 16:03:46 2008 -0500 +++ b/cmd2.py Thu Jan 15 19:38:07 2009 -0500 @@ -390,12 +390,12 @@ if self.blankLinesAllowed: blankLineTerminationParser = pyparsing.NoMatch else: - blankLineTerminator = (pyparsing.Literal('\n')('terminator') + stringEnd) + blankLineTerminator = (pyparsing.lineEnd('terminator') + stringEnd) blankLineTerminationParser = ((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + blankLineTerminator)('statement') multilineParser = (((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) + pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip())('suffix') + afterElements) singleLineParser = ((oneLineCommand + pyparsing.SkipTo(terminatorParser ^ stringEnd ^ pipe ^ outputParser).setParseAction(lambda x:x[0].strip())('args'))('statement') + - pyparsing.Optional(terminatorParser) + afterElements) + pyparsing.Optional(terminatorParser) + afterElements) self.parser = ( stringEnd | multilineParser | @@ -615,7 +615,12 @@ self.stdout.write('%s - was: %s\nnow: %s\n' % (paramName, currentVal, val)) except (ValueError, AttributeError, NotSettableError), e: self.do_show(arg) + do_set.__doc__ = '%s\nOne of: %s' % (do_set.__doc__, ', '.join(settable)) + def do_pause(self, arg): + 'Displays the specified text then waits for the user to press RETURN.' + raw_input(arg + '\n') + def do_shell(self, arg): 'execute a command as if at the OS prompt.' os.system(arg)