changeset 54:a791d615545c

oops, had to fix for redirect plus pipe
author catherine@localhost
date Mon, 09 Jun 2008 12:05:39 -0400
parents 2811505b0969
children 698710e88d1b
files README.txt cmd2.py
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/README.txt	Mon Jun 09 10:46:00 2008 -0400
+++ b/README.txt	Mon Jun 09 12:05:39 2008 -0400
@@ -6,9 +6,12 @@
 - Load commands from file, save to file, edit commands in file
 - Multi-line commands
 - Case-insensitive commands
-- Special-character shortcut commands (beyond cmd's "@" and "!")
+- Special-character shortcut commands (beyond cmd's `@` and `!`)
 - Settable environment parameters
 - Parsing commands with flags
+- Redirection to file with `>`, `>>`; input from file with `<`
+- Bare '>', '>>' with no filename send output to paste buffer
+- Pipe output to shell commands with `|`
 
 Instructions for implementing each feature follow.
 
@@ -166,4 +169,9 @@
     set maxrepeats
     -------------------------[6]
     set maxrepeats 5
-    (Cmd)
+    (Cmd) speak a dead parrot > pet.txt
+    (Cmd) speak < pet.txt
+    a dead parrot
+    (Cmd) speak only resting | wc
+      1       2      13
+    (Cmd)                      
--- a/cmd2.py	Mon Jun 09 10:46:00 2008 -0400
+++ b/cmd2.py	Mon Jun 09 12:05:39 2008 -0400
@@ -266,7 +266,10 @@
                 self.stdout = open(redirect, mode)            
             else:
                 statement = '%s %s' % (statement, self.fileimport(statement=statement, source=redirect))
-        stop = cmd.Cmd.onecmd(self, statement)
+        if isinstance(redirect, subprocess.Popen):
+            stop = self.onecmd(statement)
+        else:
+            stop = cmd.Cmd.onecmd(self, statement)
         try:
             if command not in self.excludeFromHistory:
                 self.history.append(originalStatement)