changeset 432:e4d6edca469b

get history in script form
author catherine.devlin@gmail.com
date Sun, 31 Jul 2011 16:57:15 -0400
parents f1ed2907ccab
children 5a814cb007ae
files cmd2.py docs/make.bat
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Thu Jul 28 19:26:38 2011 -0400
+++ b/cmd2.py	Sun Jul 31 16:57:15 2011 -0400
@@ -1057,7 +1057,9 @@
                 pass
             keepstate.restore()
             
-    def do_history(self, arg):
+    @options([make_option('-s', '--script', action="store_true", help="Script format; no separation lines"),
+             ], arg_desc = '(limit on which commands to include)')
+    def do_history(self, arg, opts):
         """history [arg]: lists past commands issued
         
         | no arg:         list all
@@ -1070,7 +1072,10 @@
         else:
             history = self.history
         for hi in history:
-            self.stdout.write(hi.pr())
+            if opts.script:
+                self.poutput(hi)
+            else:
+                self.stdout.write(hi.pr())
     def last_matching(self, arg):
         try:
             if arg: