Merge branch 'master' into aspace

This commit is contained in:
Anthony Scopatz 2017-12-07 18:40:38 -05:00
commit 111a651d67
46 changed files with 246 additions and 384 deletions

View file

@ -1,4 +1,4 @@
version: 0.5.12.{build}
version: 0.6.0.{build}
os: Windows Server 2012 R2
environment:

3
.gitignore vendored
View file

@ -53,3 +53,6 @@ Actually.tst
Complete_test.tst
Complete.tst
tags
# Rever
rever/

View file

@ -4,6 +4,91 @@ Xonsh Change Log
.. current developments
v0.6.0
====================
**Added:**
* Added an alias command, matching bash's implementation, available as part of bashisms.
* New ``$AUTO_SUGGEST_IN_COMPLETIONS`` environment variable that enables/disables
whether the auto-suggestion result appears in the tab completions.
* Added ``__add__()`` and ``__radd__()`` methods to ``EnvPath``.
* Xonsh now supports f-strings, as in Python v3.6+.
* Added ``ipython`` as unthreadable in command cache threadabilty predictors.
* Added ``whole_word_jumping`` xontrib
* Added ``$XONSH_APPEND_NEWLINE`` environment variable
* Support for PEP 515: Underscores in Numeric Literals
* ``xonsh.color_tools.make_palette()``
Simple rename of the pre-existing
``xonsh.color_tools.make_pallete()`` function.
* ``xonsh.tools.decorator()`` function/method decorator.
This allows for an API function to be annotated with a
decorator that documents deprecation, while also tying in
functionality that will warn a user that the function has
been deprecated, and, raise an ``AssertionError`` if the
function has passed its expiry date.
* New xontrib ``schedule`` (Xonsh Task Scheduler)
**Changed:**
* ``on_pre_prompt`` is now fired before prompt calculations are made, allowing modifications to the prompt.
* ``emacsclient`` will now return false in the threadable predictors.
* Improved the autopair behavior to match that of popular code editors.
* Moved the lazy ``pkg_resources`` package back to its original
place. The will hopefully address some of the slowdown issues
experiances on some platforms.
* When xonsh is used to run an ``xsh`` script, the ``xonshrc`` is not loaded
* Change in the behavior of the default predictor with binary analysis. The pattern ``libgpm`` is use, assuming when ``gpm`` is used the program is not threadable. This change solves issues with programs as ``links``.
* Error messages added to the ``source`` command if it is used with a language
that is not xonsh or Python.
**Deprecated:**
* ``xonsh.color_tools.make_pallette()``
Deprecated in release 0.5.10 and will be removed in release 0.6.0.
**Fixed:**
* Now f-strings can be used inside @() without explicit enclosing command in ![]
* Fix for ``x, y, *z = ...`` unpacking.
* Git branch detection now correctly passes the environment down to the subprocess
call. This allows for branch detection when git is installed into a non-standard
location.
* Escape regex characters in ``path_complete`` to avoid regex parsing errors for
certain combinations of characters in path completer
* gistatus: Fixed hash not being shown when in detaced HEAD and there are no tags
* Fix branch colorization when ``git`` or ``hg`` are aliases.
* Fixed leftover ``.git/index.lock`` in ``gitstatus``
* Made JSON history loading more robust to corrupt files.
* Starting a new command with an open parentheses will no longer
throw a traceback when ``$UPDATE_COMPLETIONS_ON_KEYPRESS`` is
``True``.
* Automatically wrapping subprocess calls would sometimes include
semincolons and other line-ending tokens, rather than stopping at them.
This has been fixed.
* Numerous spelling errors in documentation, docstrings/comments, text
strings and local variable names.
* Spelling error in the ``xonsh.color_tools.make_pallete()`` public
function declaration. This was fixed by renaming the function to
``xonsh.color_tools.make_palette()`` while maintaining a binding
of ``make_pallete()`` to the new ``make_palette()`` in case users
are already used to this API.
* Fixed issue with starting triple quote strings being run as a command.
* Fixed a problem with escaping charet (^) character for cmd.exe in the source-cmd function.
* ``EOF in multi-line statement`` errors were misreported as being on line 0.
Now they are correctly reported as being on the last line of the file.
v0.5.12
====================

View file

@ -8,6 +8,6 @@
**Fixed:**
* Now f-strings can be used inside @() without explicit enclosing command in ![]
* Clean out ``$LINES`` and ``$COLUMNS`` if set, preventing some programs from drawing weirdly
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:**
* Added an alias command, matching bash's implementation, available as part of bashisms.
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,14 +0,0 @@
**Added:**
* New ``$AUTO_SUGGEST_IN_COMPLETIONS`` environment variable that enables/disables
whether the auto-suggestion result appears in the tab completions.
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fix for ``x, y, *z = ...`` unpacking.
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:**
* ``on_pre_prompt`` is now fired before prompt calculations are made, allowing modifications to the prompt.
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,15 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Git branch detection now correctly passes the environment down to the subprocess
call. This allows for branch detection when git is installed into a non-standard
location.
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:**
* Added ``__add__()`` and ``__radd__()`` methods to ``EnvPath``.
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* gistatus: Fixed hash not being shown when in detaced HEAD and there are no tags
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fix branch colorization when ``git`` or ``hg`` are aliases.
**Security:** None

View file

@ -8,6 +8,6 @@
**Fixed:**
* Made JSON history loading more robust to corrupt files.
* Ensure that the ``free_cwd`` contrib can only be active on pure Windows.
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:**
* Xonsh now supports f-strings, as in Python v3.6+.
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fixed leftover ``.git/index.lock`` in ``gitstatus``
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:**
* Improved the autopair behavior to match that of popular code editors.
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:**
* Added ``ipython`` as unthreadable in command cache threadabilty predictors.
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:**
* Added ``whole_word_jumping`` xontrib
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:**
* Added ``$XONSH_APPEND_NEWLINE`` environment variable
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:**
* When xonsh is used to run an ``xsh`` script, the ``xonshrc`` is not loaded
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:**
* Support for PEP 515: Underscores in Numeric Literals
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,15 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Starting a new command with an open parentheses will no longer
throw a traceback when ``$UPDATE_COMPLETIONS_ON_KEYPRESS`` is
``True``.
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:**
* Change in the behavior of the default predictor with binary analysis. The pattern ``libgpm`` is use, assuming when ``gpm`` is used the program is not threadable. This change solves issues with programs as ``links``.
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,37 +0,0 @@
**Added:**
* ``xonsh.color_tools.make_palette()``
Simple rename of the pre-existing
``xonsh.color_tools.make_pallete()`` function.
* ``xonsh.tools.decorator()`` function/method decorator.
This allows for an API function to be annotated with a
decorator that documents deprecation, while also tying in
functionality that will warn a user that the function has
been deprecated, and, raise an ``AssertionError`` if the
function has passed its expiry date.
**Changed:** None
**Deprecated:**
* ``xonsh.color_tools.make_pallette()``
Deprecated in release 0.5.10 and will be removed in release 0.6.0.
**Removed:** None
**Fixed:**
* Numerous spelling errors in documentation, docstrings/comments, text
strings and local variable names.
* Spelling error in the ``xonsh.color_tools.make_pallete()`` public
function declaration. This was fixed by renaming the function to
``xonsh.color_tools.make_palette()`` while maintaining a binding
of ``make_pallete()`` to the new ``make_palette()`` in case users
are already used to this API.
**Security:** None

View file

@ -1,14 +0,0 @@
**Added:** None
**Changed:**
* Error messages added to the ``source`` command if it is used with a language
that is not xonsh or Python.
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fixed issue with starting triple quote strings being run as a command.
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fixed a problem with escaping charet (^) character for cmd.exe in the source-cmd function.
**Security:** None

View file

@ -1,13 +0,0 @@
**Added:**
* New xontrib ``schedule`` (Xonsh Task Scheduler)
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -1,14 +0,0 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* ``EOF in multi-line statement`` errors were misreported as being on line 0.
Now they are correctly reported as being on the last line of the file.
**Security:** None

31
rever.xsh Normal file
View file

@ -0,0 +1,31 @@
$PROJECT = $GITHUB_ORG = $GITHUB_REPO = 'xonsh'
$WEBSITE_URL = 'http://xon.sh'
$ACTIVITIES = ['version_bump', 'changelog', 'pytest',
'sphinx', 'tag', 'pypi', 'conda_forge', 'ghpages', 'ghrelease'
]
$VERSION_BUMP_PATTERNS = [
('.appveyor.yml', 'version:.*', 'version: $VERSION.{build}'),
('xonsh/__init__.py', '__version__\s*=.*', "__version__ = '$VERSION'"),
]
$CHANGELOG_FILENAME = 'CHANGELOG.rst'
$CHANGELOG_TEMPLATE = 'TEMPLATE.rst'
$TAG_REMOTE = 'git@github.com:xonsh/xonsh.git'
$TAG_TARGET = 'master'
$GHPAGES_REPO = 'git@github.com:scopatz/xonsh-docs.git'
$DOCKER_APT_DEPS = ['man']
with open('requirements-tests.txt') as f:
conda_deps = f.read().split()
with open('requirements-docs.txt') as f:
conda_deps += f.read().split()
conda_deps = {d.lower().split('=')[0] for d in set(conda_deps)}
conda_deps.discard('prompt-toolkit')
conda_deps |= {'prompt_toolkit', 'pip', 'psutil', 'numpy', 'matplotlib'}
$DOCKER_CONDA_DEPS = sorted(conda_deps)
$DOCKER_INSTALL_COMMAND = ('rm -rf .cache/ __pycache__/ */__pycache__ */*/__pycache__ build/ && '
'./setup.py install')
$DOCKER_GIT_NAME = 'xonsh'
$DOCKER_GIT_EMAIL = 'xonsh@googlegroups.com'

View file

@ -11,7 +11,7 @@ from xonsh.tools import ON_WINDOWS
import pytest
from xonsh.commands_cache import CommandsCache
from xonsh.environ import Env, load_static_config, locate_binary, DEFAULT_ENSURERS, DEFAULT_VALUES
from xonsh.environ import Env, load_static_config, locate_binary, DEFAULT_ENSURERS, DEFAULT_VALUES, default_env
from tools import skip_if_on_unix
@ -233,3 +233,15 @@ def test_int_bool_envvars_have_ensurers():
key_mask = set(itertools.compress(DEFAULT_VALUES.keys(), bool_ints))
ensurer_keys = set(DEFAULT_ENSURERS.keys())
assert len(key_mask.intersection(ensurer_keys)) == len(key_mask)
def test_no_lines_columns():
os.environ['LINES'] = 'spam'
os.environ['COLUMNS'] = 'eggs'
try:
env = default_env()
assert 'LINES' not in env
assert 'COLUMNS' not in env
finally:
del os.environ['LINES']
del os.environ['COLUMNS']

View file

@ -34,6 +34,11 @@ def test_which_ls():
def test_echo_hello():
assert check_parse('echo hello')
def test_echo_star_with_semi():
assert check_parse('echo * spam ; ![echo eggs]\n')
def test_simple_func():
code = ('def prompt():\n'
" return '{user}'.format(user='me')\n")

View file

@ -1,5 +1,20 @@
import pytest
from xonsh.environ import Env
import xonsh.completers.path as xcp
def test_pattern_need_quotes():
# just make sure the regex compiles
xcp.PATTERN_NEED_QUOTES.match('')
def test_complete_path(xonsh_builtins):
xonsh_builtins.__xonsh_env__ = {'CASE_SENSITIVE_COMPLETIONS': False,
'GLOB_SORTED': True,
'SUBSEQUENCE_PATH_COMPLETION': False,
'FUZZY_PATH_COMPLETION': False,
'SUGGEST_THRESHOLD': 3,
'CDPATH': set(),
}
xcp.complete_path('[1-0.1]', '[1-0.1]', 0, 7, dict())

View file

@ -27,7 +27,7 @@ from xonsh.tools import (
pathsep_to_upper_seq, seq_to_upper_pathsep, expandvars, is_int_as_str, is_slice_as_str,
ensure_timestamp, get_portions, is_balanced, subexpr_before_unbalanced,
swap_values, get_logical_line, replace_logical_line, check_quotes, deprecated,
)
is_writable_file, balanced_parens)
from xonsh.environ import Env
from tools import skip_if_on_windows, skip_if_on_unix
@ -482,6 +482,26 @@ def test_subexpr_before_unbalanced_parens(inp, exp):
assert exp == obs
@pytest.mark.parametrize('line, exp', [
('', True),
('wakka jawaka', True),
('rm *; echo hello world', True),
('()', True),
('f()', True),
('echo * yo ; echo eggs', True),
('(', False),
(')', False),
('(cmd;', False),
('cmd;)', False),
])
def test_balanced_parens(line, exp):
obs = balanced_parens(line, lexer=LEXER)
if exp:
assert obs
else:
assert not obs
@pytest.mark.parametrize('line, mincol, exp', [
('ls && echo a', 0, 4),
('ls && echo a', 6, None),
@ -491,6 +511,7 @@ def test_subexpr_before_unbalanced_parens(inp, exp):
('not (ls) && echo a', 0, 8),
('bash -c ! export var=42; echo $var', 0, 35),
('python -c ! import os; print(os.path.abspath("/"))', 0, 51),
('echo * yo ; echo eggs', 0, 11),
])
def test_find_next_break(line, mincol, exp):
obs = find_next_break(line, mincol=mincol, lexer=LEXER)
@ -1023,7 +1044,8 @@ def test_is_logfile_opt(inp, exp):
(None, None),
('throwback.log', 'throwback.log'),
skip_if_on_windows(('/dev/null', '/dev/null')),
skip_if_on_windows(('/dev/nonexistent_dev', None))
skip_if_on_windows(('/dev/nonexistent_dev',
'/dev/nonexistent_dev' if is_writable_file('/dev/nonexistent_dev') else None))
])
def test_to_logfile_opt(inp, exp):
obs = to_logfile_opt(inp)

View file

@ -25,7 +25,7 @@ VER_FULL = sys.version_info[:3]
ON_DARWIN = (platform.system() == 'Darwin')
ON_WINDOWS = (platform.system() == 'Windows')
ON_CONDA = True in [conda in pytest.__file__.lower() for conda
in ['anaconda', 'miniconda']]
in ['conda', 'anaconda', 'miniconda']]
ON_TRAVIS = 'TRAVIS' in os.environ and 'CI' in os.environ
TEST_DIR = os.path.dirname(__file__)

View file

@ -1,4 +1,4 @@
__version__ = '0.5.12'
__version__ = '0.6.0'
# amalgamate exclude jupyter_kernel parser_table parser_test_table pyghooks

View file

@ -257,6 +257,8 @@ class CtxAwareTransformer(NodeTransformer):
lexer=self.parser.lexer)
elif nlogical > 1:
maxcol = None
elif maxcol < len(line) and line[maxcol] == ';':
pass
else:
maxcol += 1
spline = subproc_toks(line, mincol=mincol, maxcol=maxcol,

View file

@ -344,6 +344,7 @@ def default_threadable_predictors():
'cls': predict_false,
'cmd': predict_shell,
'ex': predict_false,
'emacsclient': predict_false,
'fish': predict_shell,
'gvim': predict_help_ver,
'htop': predict_help_ver,

View file

@ -1,6 +1,7 @@
import os
import re
import ast
import glob
import builtins
import xonsh.tools as xt
@ -264,6 +265,7 @@ def complete_path(prefix, line, start, end, ctx, cdpath=True, filtfunc=None):
env = builtins.__xonsh_env__
csc = env.get('CASE_SENSITIVE_COMPLETIONS')
glob_sorted = env.get('GLOB_SORTED')
prefix = glob.escape(prefix)
for s in xt.iglobpath(prefix + '*', ignore_case=(not csc),
sort_result=glob_sorted):
paths.add(s)

View file

@ -1205,6 +1205,9 @@ def default_env(env=None):
ctx = dict(BASE_ENV)
ctx.update(os_environ)
ctx['PWD'] = _get_cwd() or ''
# These can cause problems for programs (#2543)
ctx.pop('LINES', None)
ctx.pop('COLUMNS', None)
# other shells' PROMPT definitions generally don't work in XONSH:
try:
del ctx['PROMPT']

View file

@ -9,7 +9,7 @@ import collections.abc as cabc
from xonsh.ast import CtxAwareTransformer
from xonsh.parser import Parser
from xonsh.tools import (subproc_toks, find_next_break, get_logical_line,
replace_logical_line)
replace_logical_line, balanced_parens)
from xonsh.built_ins import load_builtins, unload_builtins
@ -208,8 +208,9 @@ class Execer(object):
# go greedy the first time if the syntax error was because
# we hit an end token out of place. This usually indicates
# a subshell or maybe a macro.
greedy = True
maxcol = None
if not balanced_parens(line, maxcol=maxcol):
greedy = True
maxcol = None
sbpline = subproc_toks(line, returnline=True, greedy=greedy,
maxcol=maxcol, lexer=lexer)
if sbpline is None:

View file

@ -8,8 +8,13 @@ import builtins
from collections import ChainMap
from collections.abc import MutableMapping
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# DO NOT MOVE
# must come before pygments imports
from xonsh.lazyasd import load_module_in_background
load_module_in_background('pkg_resources', debug='XONSH_DEBUG',
replacements={'pygments.plugin': 'pkg_resources'})
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
from pygments.lexer import inherit, bygroups, include
from pygments.lexers.agile import PythonLexer
@ -30,9 +35,6 @@ from xonsh.style_tools import norm_name
from xonsh.lazyimps import terminal256
from xonsh.platform import os_environ
load_module_in_background('pkg_resources', debug='XONSH_DEBUG',
replacements={'pygments.plugin': 'pkg_resources'})
def _command_is_valid(cmd):
try:

View file

@ -262,6 +262,25 @@ def _is_not_lparen_and_rparen(lparens, rtok):
return rtok.type == 'RPAREN' and any(x != 'LPAREN' for x in lparens)
def balanced_parens(line, mincol=0, maxcol=None, lexer=None):
"""Determines if parentheses are balanced in an expression."""
line = line[mincol:maxcol]
if lexer is None:
lexer = builtins.__xonsh_execer__.parser.lexer
if '(' not in line and ')' not in line:
return True
cnt = 0
lexer.input(line)
for tok in lexer:
if tok.type in LPARENS:
cnt += 1
elif tok.type == 'RPAREN':
cnt -= 1
elif tok.type == 'ERRORTOKEN' and ')' in tok.value:
cnt -= 1
return cnt == 0
def find_next_break(line, mincol=0, lexer=None):
"""Returns the column number of the next logical break in subproc mode.
This function may be useful in finding the maxcol argument of

View file

@ -81,18 +81,18 @@
"description": ["Adds return code info to the prompt"]
},
{"name": "free_cwd",
"package": "xonsh",
"url": "http://xon.sh",
"description": [
"Release the lock on the current directory whenever the",
"prompt is shown. Enabling this will allow the other programs or",
"Windows Explorer to delete or rename the current or parent",
"directories. Internally, it is accomplished by temporarily resetting",
"CWD to the root drive folder while waiting at the prompt. This only",
"works with the prompt_toolkit backend and can cause cause issues",
"if any extensions are enabled that hook the prompt and relies on",
"``os.getcwd()``"]
},
"package": "xonsh",
"url": "http://xon.sh",
"description": [
"Windows only xontrib, to release the lock on the current directory",
"whenever the prompt is shown. Enabling this will allow the other",
"programs or Windows Explorer to delete or rename the current or parent",
"directories. Internally, it is accomplished by temporarily resetting",
"CWD to the root drive folder while waiting at the prompt. This only",
"works with the prompt_toolkit backend and can cause cause issues",
"if any extensions are enabled that hook the prompt and relies on",
"``os.getcwd()``"]
},
{"name": "whole_word_jumping",
"package": "xonsh",
"url": "http://xon.sh",

View file

@ -1,5 +1,5 @@
""" This will release the lock on the current directory whenever the
prompt is shown. Enabling this will allow the other programs or
prompt is shown. Enabling this will allow other programs or
Windows Explorer to delete or rename the current or parent
directories. Internally, it is accomplished by temporarily resetting
CWD to the root drive folder while waiting at the prompt. This only
@ -10,26 +10,27 @@
import os
import builtins
import functools
from pathlib import Path
from xonsh.tools import print_exception
from xonsh.platform import ON_WINDOWS, ON_CYGWIN
def _chdir_up(path):
""" Change directory to path or if path does not exist
the first valid parent.
"""
path = Path(path)
try:
os.chdir(path)
return path
except (FileNotFoundError, NotADirectoryError):
parent = os.path.dirname(path)
if parent != path:
return _chdir_up(parent)
else:
raise
path.resolve()
return _chdir_up(path.parent)
def _cwd_release_wrapper(func):
""" Decorator for Windows to the wrap the prompt function and release
""" Decorator for Windows to wrap the prompt function and release
the process lock on the current directory while the prompt is
displayed. This works by temporarily setting
the workdir to the users home directory.
@ -44,13 +45,13 @@ def _cwd_release_wrapper(func):
else:
@functools.wraps(func)
def wrapper(*args, **kwargs):
rootdir = os.path.splitdrive(os.getcwd())[0] + '\\'
os.chdir(rootdir)
anchor = Path(os.getcwd()).anchor
os.chdir(anchor)
try:
out = func(*args, **kwargs)
finally:
try:
pwd = env.get('PWD', rootdir)
pwd = env.get('PWD', anchor)
os.chdir(pwd)
except (FileNotFoundError, NotADirectoryError):
print_exception()
@ -88,7 +89,8 @@ def _cwd_restore_wrapper(func):
@events.on_ptk_create
def setup_release_cwd_hook(prompter, history, completer, bindings, **kw):
prompter.prompt = _cwd_release_wrapper(prompter.prompt)
if completer.completer:
# Temporarily restore cwd for callbacks to the completer
completer.completer.complete = _cwd_restore_wrapper(completer.completer.complete)
if ON_WINDOWS and not ON_CYGWIN:
prompter.prompt = _cwd_release_wrapper(prompter.prompt)
if completer.completer:
# Temporarily restore cwd for callbacks to the completer
completer.completer.complete = _cwd_restore_wrapper(completer.completer.complete)

View file

@ -100,7 +100,7 @@ class VoxHandler:
try:
self.vox.activate(args.name)
except KeyError:
print('This environment doesn\'t exist. Create it with "vox new %s".\n' % name, file=sys.stderr)
print('This environment doesn\'t exist. Create it with "vox new %s".\n' % args.name, file=sys.stderr)
return None
else:
print('Activated "%s".\n' % args.name)