# HG changeset patch # User catherine@Elli.myhome.westell.com # Date 1214428199 14400 # Node ID 101283b63e1b159755491f09f67d401185c9b673 # Parent 6031a06bb6d7e30cb05e6491e23fe95dd3c7a8e6 hmm, getting hard to split search/do not search diff -r 6031a06bb6d7 -r 101283b63e1b cmd2.py --- a/cmd2.py Wed Jun 25 12:53:03 2008 -0400 +++ b/cmd2.py Wed Jun 25 17:09:59 2008 -0400 @@ -255,30 +255,35 @@ commands by the interpreter should stop. """ + statekeeper = None + stop = 0 command, args = self.extractCommand(line) statement = originalStatement = ' '.join([command, args]) - suffix = statement if (not assumeComplete) and (command in self.multilineCommands): - statement, suffix = self.completedStatement(statement) - statekeeper = None - stop = 0 - - inputFrom = self.input_source_finder(suffix) + statement, afterTerminator = self.completedStatement(statement) + inputFrom = self.input_source_finder(afterTerminator) + if inputFrom: + statement = "%s %s" % (statement, inputFrom[0]) + else: + inputFrom = self.input_source_finder(statement) + if inputFrom: + statement = inputFrom[0] + if inputFrom: source = inputFrom[-1] if source: - statement = '%s %s' % (statement, self.fileimport(statement=statement, source=source)) + statement = '%s %s' % (statement, self.fileimport(source=source)) else: - statement = '%s %s' % (statement, getPasteBuffer()) + statement = '%sy %s' % (statement, getPasteBuffer()) - pipeTo = self.pipe_destination_finder(suffix) + pipeTo = self.pipe_destination_finder(afterTerminator) if pipeTo: pipeTo = 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(suffix) + outputTo = self.output_destination_finder(afterTerminator) if outputTo: destination = outputTo[-1] statekeeper = Statekeeper(self, ('stdout',)) @@ -558,7 +563,7 @@ stop = self.postcmd(stop, runme) do_r = do_run - def fileimport(self, statement, source): + def fileimport(self, source): try: f = open(source) except IOError: