# HG changeset patch # User catherine@Elli.myhome.westell.com # Date 1214411541 14400 # Node ID ea1697be3d00dfc5cfaf96db7b3a99130893c480 # Parent 48b0bf2e3d2e092e1b87b1b7dc7b073db64a02f6 getting suffix diff -r 48b0bf2e3d2e -r ea1697be3d00 cmd2.py --- a/cmd2.py Mon Jun 23 22:17:28 2008 -0400 +++ b/cmd2.py Wed Jun 25 12:32:21 2008 -0400 @@ -235,10 +235,12 @@ def completedStatement(self, firstline): statement = firstline - while not self.commmand_terminator_finder(statement): + termination_found = self.commmand_terminator_finder(statement) + while not termination_found: inp = self.pseudo_raw_input(self.continuationPrompt) statement = '%s\n%s' % (statement, inp) - return statement + termination_found = self.commmand_terminator_finder(statement) + return termination_found[0], termination_found[-1] # assembling a list of lines and joining them at the end would be faster, # but statementHasEnded needs a string arg; anyway, we're getting # user input and users are slow. @@ -255,12 +257,13 @@ """ command, args = self.extractCommand(line) statement = originalStatement = ' '.join([command, args]) + suffix = statement if (not assumeComplete) and (command in self.multilineCommands): - statement = self.completedStatement(statement) + statement, suffix = self.completedStatement(statement) statekeeper = None stop = 0 - inputFrom = self.input_source_finder(statement) + inputFrom = self.input_source_finder(suffix) if inputFrom: statement, source = inputFrom[0], inputFrom[-1] if source: @@ -268,14 +271,14 @@ else: statement = '%s %s' % (statement, getPasteBuffer()) - pipeTo = self.pipe_destination_finder(statement) + pipeTo = self.pipe_destination_finder(suffix) if pipeTo: statement, pipeTo = pipeTo[0], pipeTo[-1] statekeeper = Statekeeper(self, ('stdout',)) pipeTo = subprocess.Popen(pipeTo, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) self.stdout = pipeTo.stdin else: # can't pipe output AND send it to a file - outputTo = self.output_destination_finder(statement) + outputTo = self.output_destination_finder(suffix) if outputTo: statement, destination = outputTo[0], outputTo[-1] statekeeper = Statekeeper(self, ('stdout',))