# HG changeset patch # User catherine@Elli.myhome.westell.com # Date 1232066287 18000 # Node ID 1c21db096f49121da6d672f02bf3dfd99cc8e157 # Parent 24eff658997b80cca9dc27491b048ba303b1af17 switched literal newline to lineEnd diff -r 24eff658997b -r 1c21db096f49 cmd2.py --- 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)