Added support for configuration through ~/.config/xonsh/rc.xsh

This commit is contained in:
Anthony Scopatz 2018-04-11 11:30:20 -04:00
parent bd5be59f00
commit 304b0bd81b
2 changed files with 19 additions and 3 deletions

14
news/xdgconf.rst Normal file
View file

@ -0,0 +1,14 @@
**Added:** None
**Changed:**
* Xonsh run control now also looks for the XDG-compliant file
``~/.config/xonsh/rc.xsh`` at startup.
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -247,13 +247,15 @@ def xonshconfig(env):
@default_value
def default_xonshrc(env):
"""Creates a new instance of the default xonshrc tuple."""
xcdrc = os.path.join(xonsh_config_dir(env), 'rc.xsh')
if ON_WINDOWS:
dxrc = (xonshconfig(env),
os.path.join(os_environ['ALLUSERSPROFILE'],
'xonsh', 'xonshrc'),
xcdrc,
os.path.expanduser('~/.xonshrc'))
else:
dxrc = (xonshconfig(env), '/etc/xonshrc', os.path.expanduser('~/.xonshrc'))
dxrc = (xonshconfig(env), '/etc/xonshrc', xcdrc, os.path.expanduser('~/.xonshrc'))
return dxrc
@ -656,9 +658,9 @@ def DEFAULT_DOCS():
'A list of the locations of run control files, if they exist. User '
'defined run control file will supersede values set in system-wide '
'control file if there is a naming collision.', default=(
"On Linux & Mac OSX: ``['/etc/xonshrc', '~/.xonshrc']``\n"
"On Linux & Mac OSX: ``['/etc/xonshrc', '~/.config/xonsh/rc.xsh', '~/.xonshrc']``\n"
"\nOn Windows: "
"``['%ALLUSERSPROFILE%\\\\xonsh\\\\xonshrc', '~/.xonshrc']``")),
"``['%ALLUSERSPROFILE%\\\\xonsh\\\\xonshrc', '~/.config/xonsh/rc.xsh', '~/.xonshrc']``")),
'XONSH_APPEND_NEWLINE': VarDocs(
'Append new line when a partial line is preserved in output.'
),