# HG changeset patch # User devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil # Date 1198270912 18000 # Node ID d3b2f9c6e5364acb96b4f41e5370e49a3fbfa8ab # Parent 061f40299ed5b37a3472c871bed3b2c84584014d run diff -r 061f40299ed5 -r d3b2f9c6e536 cmd2.py --- 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): diff -r 061f40299ed5 -r d3b2f9c6e536 sqlpyPlus.py --- a/sqlpyPlus.py Fri Dec 21 15:56:33 2007 -0500 +++ b/sqlpyPlus.py Fri Dec 21 16:01:52 2007 -0500 @@ -680,20 +680,6 @@ bufferPosPattern = re.compile('\d+') rangeIndicators = ('-',':') - - 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 - self.onecmd_plus_hooks(runme) - do_r = do_run def do_get(self, fname): 'Brings SQL commands from a file to the in-memory SQL buffer.'