summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcatherine devlin <catherine.devlin@gmail.com>2011-07-31 16:57:15 -0400
committercatherine devlin <catherine.devlin@gmail.com>2011-07-31 16:57:15 -0400
commitc2f414d35ed2b5ecec74abe8fdf310403e2313f4 (patch)
treeb1d2973255b8c0e03902566c0cc68532f9411db7
parentad89cf02221826d67b73d9e80f47024176d612ef (diff)
downloadcmd2-hg-c2f414d35ed2b5ecec74abe8fdf310403e2313f4.tar.gz
get history in script form
-rwxr-xr-xcmd2.py9
-rwxr-xr-x[-rw-r--r--]docs/make.bat0
2 files changed, 7 insertions, 2 deletions
diff --git a/cmd2.py b/cmd2.py
index 218f8b8..da36b55 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1057,7 +1057,9 @@ class Cmd(cmd.Cmd):
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 @@ class Cmd(cmd.Cmd):
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:
diff --git a/docs/make.bat b/docs/make.bat
index 3e88e03..3e88e03 100644..100755
--- a/docs/make.bat
+++ b/docs/make.bat