mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Use regex expression to find unquoted version of the strings.
This commit is contained in:
parent
e28968e90b
commit
70acb5d793
1 changed files with 10 additions and 2 deletions
|
@ -277,6 +277,14 @@ def complete_path(prefix, line, start, end, ctx, cdpath=True):
|
|||
return paths, lprefix
|
||||
|
||||
|
||||
RE_UNQUOTE = re.compile("""(?:[rub](?P<q1>["'])|(?P<q2>["']?))(.+)(?:(?P=q1)|(?P=q2))$""")
|
||||
|
||||
|
||||
def complete_dir(prefix, line, start, end, ctx, cdpath=False):
|
||||
o, lp = complete_path(prefix, line, start, end, cdpath)
|
||||
return {i for i in o if os.path.isdir(i.strip(''''"'''))}, lp
|
||||
paths, lp = complete_path(prefix, line, start, end, cdpath)
|
||||
dirs = set()
|
||||
for path in paths:
|
||||
m = RE_UNQUOTE.match(path)
|
||||
if m and os.path.isdir(m.group(2)):
|
||||
dirs.add(path)
|
||||
return dirs, lp
|
||||
|
|
Loading…
Add table
Reference in a new issue