From 24d091c9d3442b9e384d83c4b80a508379cb0985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Sun, 11 Feb 2024 13:57:18 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(python):=20add=20pythonrc=20to?= =?UTF-8?q?=20respect=20the=20xdg=20specification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/python/pythonrc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .config/python/pythonrc diff --git a/.config/python/pythonrc b/.config/python/pythonrc new file mode 100644 index 00000000..f3f86a5e --- /dev/null +++ b/.config/python/pythonrc @@ -0,0 +1,17 @@ +import os +import atexit +import readline + +history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history') +try: + readline.read_history_file(history) +except OSError: + pass + +def write_history(): + try: + readline.write_history_file(history) + except OSError: + pass + +atexit.register(write_history)