mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
Merge branch 'master' of https://github.com/gforsyth/xonsh into gforsyth-master
This commit is contained in:
commit
4c4eb2d705
3 changed files with 15 additions and 2 deletions
|
@ -16,9 +16,12 @@ applicable.
|
||||||
* - ANSICON
|
* - ANSICON
|
||||||
- No default set
|
- No default set
|
||||||
- This is used on Windows to set the title, if available.
|
- This is used on Windows to set the title, if available.
|
||||||
|
* - AUTO_CD
|
||||||
|
- ``False``
|
||||||
|
- Flag to enable changing to a directory by entering the dirname or full path only (without the `cd` command)
|
||||||
* - AUTO_PUSHD
|
* - AUTO_PUSHD
|
||||||
- ``False``
|
- ``False``
|
||||||
- Flag for automatically pushing directorties onto the directory stack.
|
- Flag for automatically pushing directories onto the directory stack.
|
||||||
* - AUTO_SUGGEST
|
* - AUTO_SUGGEST
|
||||||
- ``True``
|
- ``True``
|
||||||
- Enable automatic command suggestions based on history (like in fish shell).
|
- Enable automatic command suggestions based on history (like in fish shell).
|
||||||
|
|
|
@ -21,7 +21,7 @@ from collections import Sequence, MutableMapping, Iterable, namedtuple, \
|
||||||
from xonsh.tools import suggest_commands, XonshError, ON_POSIX, ON_WINDOWS, \
|
from xonsh.tools import suggest_commands, XonshError, ON_POSIX, ON_WINDOWS, \
|
||||||
string_types
|
string_types
|
||||||
from xonsh.inspectors import Inspector
|
from xonsh.inspectors import Inspector
|
||||||
from xonsh.environ import Env, default_env
|
from xonsh.environ import Env, default_env, locate_binary
|
||||||
from xonsh.aliases import DEFAULT_ALIASES
|
from xonsh.aliases import DEFAULT_ALIASES
|
||||||
from xonsh.jobs import add_job, wait_for_active_job
|
from xonsh.jobs import add_job, wait_for_active_job
|
||||||
from xonsh.proc import ProcProxy, SimpleProcProxy, TeePTYProc
|
from xonsh.proc import ProcProxy, SimpleProcProxy, TeePTYProc
|
||||||
|
@ -523,6 +523,14 @@ def run_subproc(cmds, captured=True):
|
||||||
stderr = streams['stderr']
|
stderr = streams['stderr']
|
||||||
uninew = (ix == last_cmd) and (not captured)
|
uninew = (ix == last_cmd) and (not captured)
|
||||||
alias = builtins.aliases.get(cmd[0], None)
|
alias = builtins.aliases.get(cmd[0], None)
|
||||||
|
if (alias is None
|
||||||
|
and builtins.__xonsh_env__.get('AUTO_CD')
|
||||||
|
and os.path.isdir(cmd[0])
|
||||||
|
and locate_binary(cmd[0], cwd=None) is None
|
||||||
|
and len(cmds)==1):
|
||||||
|
cmd.insert(0, 'cd')
|
||||||
|
alias = builtins.aliases.get('cd', None)
|
||||||
|
|
||||||
if callable(alias):
|
if callable(alias):
|
||||||
aliased_cmd = alias
|
aliased_cmd = alias
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -48,6 +48,7 @@ represent environment variable validation, conversion, detyping.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DEFAULT_ENSURERS = {
|
DEFAULT_ENSURERS = {
|
||||||
|
'AUTO_CD': (is_bool, to_bool, bool_to_str),
|
||||||
'AUTO_SUGGEST': (is_bool, to_bool, bool_to_str),
|
'AUTO_SUGGEST': (is_bool, to_bool, bool_to_str),
|
||||||
'BASH_COMPLETIONS': (is_env_path, str_to_env_path, env_path_to_str),
|
'BASH_COMPLETIONS': (is_env_path, str_to_env_path, env_path_to_str),
|
||||||
'CASE_SENSITIVE_COMPLETIONS': (is_bool, to_bool, bool_to_str),
|
'CASE_SENSITIVE_COMPLETIONS': (is_bool, to_bool, bool_to_str),
|
||||||
|
@ -114,6 +115,7 @@ def xonshconfig(env):
|
||||||
# to set them they have to do a copy and write them to the environment.
|
# to set them they have to do a copy and write them to the environment.
|
||||||
# try to keep this sorted.
|
# try to keep this sorted.
|
||||||
DEFAULT_VALUES = {
|
DEFAULT_VALUES = {
|
||||||
|
'AUTO_CD': False,
|
||||||
'AUTO_PUSHD': False,
|
'AUTO_PUSHD': False,
|
||||||
'AUTO_SUGGEST': True,
|
'AUTO_SUGGEST': True,
|
||||||
'BASH_COMPLETIONS': (('/usr/local/etc/bash_completion',
|
'BASH_COMPLETIONS': (('/usr/local/etc/bash_completion',
|
||||||
|
|
Loading…
Add table
Reference in a new issue