changeset 73:101283b63e1b

hmm, getting hard to split search/do not search
author catherine@Elli.myhome.westell.com
date Wed, 25 Jun 2008 17:09:59 -0400
parents 6031a06bb6d7
children 4e290d75e92e
files cmd2.py
diffstat 1 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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: