mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
19 lines
402 B
Python
19 lines
402 B
Python
|
import atexit
|
||
|
import os
|
||
|
import readline
|
||
|
from pathlib import Path
|
||
|
|
||
|
cache_xdg_dir = Path(os.environ.get("XDG_CACHE_HOME", str(Path("~/.cache"))))
|
||
|
cache_xdg_dir.mkdir(exist_ok=True, parents=True)
|
||
|
|
||
|
history_file = cache_xdg_dir.joinpath("python_history")
|
||
|
|
||
|
readline.read_history_file(history_file)
|
||
|
|
||
|
|
||
|
def write_history() -> None:
|
||
|
readline.write_history_file(history_file)
|
||
|
|
||
|
|
||
|
atexit.register(write_history)
|