comparison cmd2.py @ 119:fe47c5b269cc release 0.4, uploaded to PyPI

altering README to match exampleSession.txt
author catherine@dellzilla
date Tue, 28 Oct 2008 14:09:44 -0400
parents 33cd0e1bebb8
children fe432d010ecc
comparison
equal deleted inserted replaced
118:db366853074c 119:fe47c5b269cc
726 self.bookmark = 0 726 self.bookmark = 0
727 def refreshCommandFinder(self): 727 def refreshCommandFinder(self):
728 prompt = pyparsing.Suppress(pyparsing.lineStart + self.cmdapp.prompt) 728 prompt = pyparsing.Suppress(pyparsing.lineStart + self.cmdapp.prompt)
729 continuationPrompt = pyparsing.Suppress(pyparsing.lineStart + self.cmdapp.continuationPrompt) 729 continuationPrompt = pyparsing.Suppress(pyparsing.lineStart + self.cmdapp.continuationPrompt)
730 self.cmdtxtPattern = (prompt + pyparsing.restOfLine + pyparsing.ZeroOrMore( 730 self.cmdtxtPattern = (prompt + pyparsing.restOfLine + pyparsing.ZeroOrMore(
731 pyparsing.lineEnd + continuationPrompt + pyparsing.restOfLine))("command") 731 pyparsing.lineEnd + continuationPrompt + pyparsing.restOfLine))("command")
732 def inputGenerator(self): 732 def inputGenerator(self):
733 while True: 733 while True:
734 self.refreshCommandFinder() 734 self.refreshCommandFinder()
735 (thiscmd, startpos, endpos) = self.cmdtxtPattern.scanString(self.transcript[self.bookmark:], maxMatches=1).next() 735 (thiscmd, startpos, endpos) = self.cmdtxtPattern.scanString(self.transcript[self.bookmark:], maxMatches=1).next()
736 lineNum = self.transcript.count('\n', 0, self.bookmark+startpos) + 2 736 lineNum = self.transcript.count('\n', 0, self.bookmark+startpos) + 2