add get_sep to tools and use in completionwrap

This commit is contained in:
Gil Forsyth 2015-12-05 18:25:25 -05:00
parent 09702594a1
commit 75672be2d2
2 changed files with 10 additions and 2 deletions

View file

@ -9,7 +9,7 @@ import subprocess
import sys
from xonsh.built_ins import iglobpath
from xonsh.tools import subexpr_from_unbalanced
from xonsh.tools import subexpr_from_unbalanced, get_sep
from xonsh.tools import ON_WINDOWS
@ -85,7 +85,7 @@ def completionwrap(s):
a 'problem' token that will confuse the xonsh parser
"""
space = ' '
slash = '/'
slash = get_sep()
return (_normpath(repr(s + (slash if os.path.isdir(s) else '')))
if COMPLETION_WRAP_TOKENS.intersection(s) else
s + space

View file

@ -204,6 +204,14 @@ def indent(instr, nspaces=4, ntabs=0, flatten=False):
else:
return outstr
def get_sep():
""" Returns the appropriate filepath separator char depending on OS and
xonsh options set
"""
return (os.altsep if ON_WINDOWS
and builtins.__xonsh_env__.get('FORCE_POSIX_PATHS') else
os.sep)
TERM_COLORS = {
# Reset