2019-11-24 15:50:07 +01:00
|
|
|
import atexit
|
|
|
|
import os
|
|
|
|
import readline
|
|
|
|
|
|
|
|
histfile = os.path.join(os.getenv(
|
2020-03-23 12:23:14 +01:00
|
|
|
'XDG_CACHE_HOME', os.path.expanduser('~/.cache')
|
2019-11-24 15:50:07 +01:00
|
|
|
), '.python_history')
|
|
|
|
|
|
|
|
try:
|
|
|
|
readline.read_history_file(histfile)
|
|
|
|
readline.set_history_length(1000)
|
|
|
|
except FileNotFoundError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
atexit.register(readline.write_history_file, histfile)
|