✨ feat(python): add pythonrc to respect the xdg specification
This commit is contained in:
parent
e0383ec1ee
commit
24d091c9d3
1 changed files with 17 additions and 0 deletions
17
.config/python/pythonrc
Normal file
17
.config/python/pythonrc
Normal file
|
@ -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)
|
Loading…
Add table
Reference in a new issue