Merge branch 'gforsyth-add_env_completion'

This commit is contained in:
Anthony Scopatz 2016-05-25 17:50:31 -04:00
commit 31ca63e172
2 changed files with 7 additions and 5 deletions

View file

@ -11,6 +11,8 @@ Current Developments
* Added comma literals to subproc mode.
* ``@$(cmd)`` has been added as a subprocess-mode operator, which replaces in
the subprocess command itself with the result of running ``cmd``.
* The ``${...}`` shortcut for ``__xonsh_env__`` now returns appropriate
completion options
**Changed:**

View file

@ -19,7 +19,7 @@ from xonsh.tools import (subexpr_from_unbalanced, get_sep,
RE_DASHF = re.compile(r'-F\s+(\w+)')
RE_ATTR = re.compile(r'(\S+(\..+)*)\.(\w*)$')
RE_ATTR = re.compile(r'([^\s\(\)]+(\.[^\s\(\)]+)*)\.(\w*)$')
RE_WIN_DRIVE = re.compile(r'^([a-zA-Z]):\\')
@ -199,7 +199,7 @@ class Completer(object):
# python mode explicitly
return self._python_mode_completions(prefix, ctx,
prefixlow,
startswither)
startswither), lprefix
elif prefix.startswith('-'):
comps = self._man_completer.option_complete(prefix, cmd)
return sorted(comps), lprefix
@ -526,11 +526,11 @@ class Completer(object):
expr = subexpr_from_unbalanced(expr, '{', '}')
_ctx = None
try:
val = eval(expr, ctx)
val = builtins.__xonsh_execer__.eval(expr, ctx)
_ctx = ctx
except: # pylint:disable=bare-except
try:
val = eval(expr, builtins.__dict__)
val = builtins.__xonsh_execer__.eval(expr, builtins.__dict__)
_ctx = builtins.__dict__
except: # pylint:disable=bare-except
return attrs # anything could have gone wrong!
@ -539,7 +539,7 @@ class Completer(object):
opts = []
for i in _opts:
try:
eval('{0}.{1}'.format(expr, i), _ctx)
builtins.__xonsh_execer__.eval('{0}.{1}'.format(expr, i), _ctx)
except: # pylint:disable=bare-except
continue
else: