Mercurial > sqlpython
changeset 34:d3b2f9c6e536
run
author | devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil |
---|---|
date | Fri, 21 Dec 2007 16:01:52 -0500 |
parents | 061f40299ed5 |
children | e2a5cdba3113 |
files | cmd2.py sqlpyPlus.py |
diffstat | 2 files changed, 18 insertions(+), 15 deletions(-) [+] |
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):
--- 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.'