Skip to content

Commit 94cc161

Browse files
committed
feat: Add support for executing previous commands in sqlite3-cli-manager
1 parent aabaaca commit 94cc161

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

manager.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class Interactive(cmd.Cmd):
215215
intro = (
216216
"Welcome to interactive sqlite3-db manager.\n"
217217
"Run help or h <command> for usage info.\n"
218+
"Use '!' to execute previous commands.\n"
218219
"Repository : https://github.com/Simatwa/sqlite3-cli-manager"
219220
)
220221
__init_time = time.time()
@@ -424,14 +425,14 @@ def default(self, line: str, prompt_confirmation: bool = False, ai_generated=Fal
424425
if line.startswith("./"):
425426
self.do_sys(line[2:])
426427
return
427-
428+
# self.onecmd
428429
elif line.startswith("!"):
429430
# Let's try to mimic the unix' previous command(s) execution shortcut
430431
history = self.completer_session.history.get_strings()
431432
command_number = line.count("!")
432433
if len(history) >= command_number:
433-
line = [history[-command_number - 1]]
434-
prompt_confirmation = True
434+
line = history[-command_number - 1]
435+
return self.onecmd(line)
435436
else:
436437
click.secho("Index out of range!", fg="yellow")
437438
return

0 commit comments

Comments
 (0)