Mercurial > sqlpython
diff cmd2.py @ 34:d3b2f9c6e536
run
author | devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil |
---|---|
date | Fri, 21 Dec 2007 16:01:52 -0500 |
parents | 061f40299ed5 |
children | e2a5cdba3113 |
line wrap: on
line diff
--- a/cmd2.py Fri Dec 21 15:56:33 2007 -0500 +++ b/cmd2.py Fri Dec 21 16:01:52 2007 -0500 @@ -8,7 +8,7 @@ Settable environment parameters still to do: -edit +edit spits eof run > """ @@ -286,6 +286,23 @@ self.stdin.close() keepstate.restore() self.lastcmd = '' + + def do_run(self, arg): + """run [arg]: re-runs an earlier command + + no arg -> run most recent command + arg is integer -> run one history item, by index + arg is string -> run most recent command by string search + arg is /enclosed in forward-slashes/ -> run most recent by regex + """ + 'run [N]: runs the SQL that was run N commands ago' + runme = self.last_matching(arg) + print runme + if runme: + runme = self.precmd(runme) + stop = self.onecmd(runme) + stop = self.postcmd(stop, runme) + do_r = do_run class HistoryItem(str): def __init__(self, instr):