mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Fix BASH_COMPLETIONS
not working on Windows
This commit is contained in:
parent
8a55f2b093
commit
432a183b46
1 changed files with 3 additions and 0 deletions
|
@ -14,6 +14,7 @@ from xonsh.tools import ON_WINDOWS
|
|||
|
||||
RE_DASHF = re.compile(r'-F\s+(\w+)')
|
||||
RE_ATTR = re.compile(r'(\S+(\..+)*)\.(\w*)$')
|
||||
RE_WIN_DRIVE = re.compile(r'^([a-zA-Z]):\\')
|
||||
|
||||
XONSH_TOKENS = {
|
||||
'and ', 'as ', 'assert ', 'break', 'class ', 'continue', 'def ', 'del ',
|
||||
|
@ -271,6 +272,8 @@ class Completer(object):
|
|||
srcs = []
|
||||
for f in builtins.__xonsh_env__.get('BASH_COMPLETIONS', ()):
|
||||
if os.path.isfile(f):
|
||||
if ON_WINDOWS: # We need to "Unixify" Windows paths for Bash to understand
|
||||
f = RE_WIN_DRIVE.sub(lambda m: '/{0}/'.format(m.group(1).lower()), f).replace('\\', '/')
|
||||
srcs.append('source ' + f)
|
||||
return srcs
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue