changeset 103:e4daf715fc31

echo on
author catherine@dellzilla
date Tue, 14 Oct 2008 15:28:37 -0400
parents 5d241111b3d6
children bd91925d813c
files cmd2/cmd2.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2/cmd2.py	Mon Sep 29 13:06:07 2008 -0400
+++ b/cmd2/cmd2.py	Tue Oct 14 15:28:37 2008 -0400
@@ -146,6 +146,7 @@
     return result
         
 class Cmd(cmd.Cmd):
+    echo = False
     caseInsensitive = True
     multilineCommands = []
     continuationPrompt = '> '    
@@ -163,7 +164,7 @@
                 if not os.system('which %s' % (editor)):
                     break
             
-    settable = ['prompt', 'continuationPrompt', 'defaultFileName', 'editor', 'caseInsensitive']
+    settable = ['prompt', 'continuationPrompt', 'defaultFileName', 'editor', 'caseInsensitive', 'echo']
     _TO_PASTE_BUFFER = 1
     def do_cmdenvironment(self, args):
         self.stdout.write("""
@@ -382,6 +383,8 @@
                     line = self.cmdqueue.pop(0)
                 else:
                     line = self.pseudo_raw_input(self.prompt)
+                if (self.echo) and (isinstance(self.stdin, file)):
+                    self.stdout.write(line + '\n')
                 line = self.precmd(line)
                 stop = self.onecmd(line)
                 stop = self.postcmd(stop, line)