# HG changeset patch # User catherine@localhost # Date 1213027539 14400 # Node ID a791d615545c42a94278ec94f2f80c4fe405ceaf # Parent 2811505b09692d0b9078c4fb7c5c7fd1a7d80ff4 oops, had to fix for redirect plus pipe diff -r 2811505b0969 -r a791d615545c README.txt --- 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) diff -r 2811505b0969 -r a791d615545c cmd2.py --- 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)