diff options
author | catherine devlin <catherine.devlin@gmail.com> | 2011-07-31 16:57:15 -0400 |
---|---|---|
committer | catherine devlin <catherine.devlin@gmail.com> | 2011-07-31 16:57:15 -0400 |
commit | c2f414d35ed2b5ecec74abe8fdf310403e2313f4 (patch) | |
tree | b1d2973255b8c0e03902566c0cc68532f9411db7 | |
parent | ad89cf02221826d67b73d9e80f47024176d612ef (diff) | |
download | cmd2-hg-c2f414d35ed2b5ecec74abe8fdf310403e2313f4.tar.gz |
get history in script form
-rwxr-xr-x | cmd2.py | 9 | ||||
-rwxr-xr-x[-rw-r--r--] | docs/make.bat | 0 |
2 files changed, 7 insertions, 2 deletions
@@ -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 |