aboutsummaryrefslogtreecommitdiffstats
path: root/python/examples/console.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/examples/console.py')
-rw-r--r--python/examples/console.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/examples/console.py b/python/examples/console.py
index 225c7eb..8a3ab3b 100644
--- a/python/examples/console.py
+++ b/python/examples/console.py
@@ -14,6 +14,22 @@ from cmd2 import Cmd, make_option, options, Cmd2TestCase
import optparse
import json
+import atexit
+import os
+import readline
+import rlcompleter
+
+historyPath = os.path.expanduser("~/.pubnub_console_history")
+
+def save_history(historyPath=historyPath):
+ import readline
+ readline.write_history_file(historyPath)
+
+if os.path.exists(historyPath):
+ readline.read_history_file(historyPath)
+
+atexit.register(save_history)
+
of=sys.stdout
color = Cmd()