2010-11-01 14:51:16 -07:00
|
|
|
import atexit
|
|
|
|
import os
|
|
|
|
import readline
|
|
|
|
import rlcompleter
|
|
|
|
|
|
|
|
historyPath = os.path.expanduser("~/.pyhistory")
|
|
|
|
|
2011-09-17 14:38:49 -07:00
|
|
|
|
2010-11-01 14:51:16 -07:00
|
|
|
def save_history(historyPath=historyPath):
|
2011-09-17 14:38:49 -07:00
|
|
|
import readline
|
|
|
|
readline.write_history_file(historyPath)
|
2010-11-01 14:51:16 -07:00
|
|
|
|
|
|
|
if os.path.exists(historyPath):
|
2011-09-17 14:38:49 -07:00
|
|
|
readline.read_history_file(historyPath)
|
2010-11-01 14:51:16 -07:00
|
|
|
|
2011-09-27 14:23:42 -07:00
|
|
|
rl = rlcompleter
|
|
|
|
|
2010-11-01 14:51:16 -07:00
|
|
|
atexit.register(save_history)
|
2011-09-27 14:23:42 -07:00
|
|
|
del os, atexit, readline, rl, save_history, historyPath
|