mirror of
https://github.com/frida/frida-python
synced 2026-06-08 14:16:17 +00:00
Merge pull request #23 from Tyilo/repl-hist
Save the repl's history in ~/.frida_history
This commit is contained in:
@@ -14,6 +14,10 @@ def main():
|
||||
HAVE_READLINE = False
|
||||
import sys
|
||||
import threading
|
||||
import os
|
||||
|
||||
if HAVE_READLINE:
|
||||
HIST_FILE = os.path.join(os.path.expanduser("~"), ".frida_history")
|
||||
|
||||
class REPLApplication(ConsoleApplication):
|
||||
def __init__(self):
|
||||
@@ -24,6 +28,12 @@ def main():
|
||||
readline.parse_and_bind("set show-all-if-ambiguous on")
|
||||
# Set our custom completer
|
||||
readline.set_completer(self.completer)
|
||||
|
||||
try:
|
||||
readline.read_history_file(HIST_FILE)
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
self._idle = threading.Event()
|
||||
self._cond = threading.Condition()
|
||||
self._response = None
|
||||
@@ -204,6 +214,10 @@ def main():
|
||||
|
||||
if HAVE_READLINE:
|
||||
readline.add_history(expression)
|
||||
try:
|
||||
readline.write_history_file(HIST_FILE)
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
if expression.endswith("?"):
|
||||
# Help feature
|
||||
|
||||
Reference in New Issue
Block a user