Commit 0699cfc3 authored by Guillaume Seguin's avatar Guillaume Seguin

Add cross-execution history support to pronsole

parent 84edbc20
...@@ -470,6 +470,7 @@ class pronsole(cmd.Cmd): ...@@ -470,6 +470,7 @@ class pronsole(cmd.Cmd):
self.percentdone = 0 self.percentdone = 0
self.tempreadings = "" self.tempreadings = ""
self.macros = {} self.macros = {}
self.history_file = "~/.pronsole-history"
self.rc_loaded = False self.rc_loaded = False
self.processing_rc = False self.processing_rc = False
self.processing_args = False self.processing_args = False
...@@ -521,6 +522,9 @@ class pronsole(cmd.Cmd): ...@@ -521,6 +522,9 @@ class pronsole(cmd.Cmd):
self.old_completer = readline.get_completer() self.old_completer = readline.get_completer()
readline.set_completer(self.complete) readline.set_completer(self.complete)
readline.parse_and_bind(self.completekey + ": complete") readline.parse_and_bind(self.completekey + ": complete")
history = os.path.expanduser(self.history_file)
if os.path.exists(history):
readline.read_history_file(history)
except ImportError: except ImportError:
pass pass
try: try:
...@@ -559,6 +563,7 @@ class pronsole(cmd.Cmd): ...@@ -559,6 +563,7 @@ class pronsole(cmd.Cmd):
try: try:
import readline import readline
readline.set_completer(self.old_completer) readline.set_completer(self.old_completer)
readline.write_history_file(history)
except ImportError: except ImportError:
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment