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 | ccd61223a081ae4bc4d49f974b15940213d03925 (patch) | |
| tree | b1d2973255b8c0e03902566c0cc68532f9411db7 | |
| parent | e92d4ce3603c0fe742a32299a12af5608df7c53d (diff) | |
| download | cmd2-git-ccd61223a081ae4bc4d49f974b15940213d03925.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 3e88e035..3e88e035 100644..100755 --- a/docs/make.bat +++ b/docs/make.bat |
