mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
add get_sep to tools and use in completionwrap
This commit is contained in:
parent
09702594a1
commit
75672be2d2
2 changed files with 10 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue