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
commitccd61223a081ae4bc4d49f974b15940213d03925 (patch)
treeb1d2973255b8c0e03902566c0cc68532f9411db7
parente92d4ce3603c0fe742a32299a12af5608df7c53d (diff)
downloadcmd2-git-ccd61223a081ae4bc4d49f974b15940213d03925.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 218f8b86..da36b55d 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 3e88e035..3e88e035 100644..100755
--- a/docs/make.bat
+++ b/docs/make.bat