mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Some tests and changelog
This commit is contained in:
parent
61fe13bc77
commit
a8d63110f3
4 changed files with 54 additions and 7 deletions
52
news/execaliasbash.rst
Normal file
52
news/execaliasbash.rst
Normal file
|
@ -0,0 +1,52 @@
|
|||
**Added:**
|
||||
|
||||
* Aliases from foreign shells (e.g. Bash) that are more than single expressions,
|
||||
or contain sub-shell executions, are now evaluated and run in the foreign shell.
|
||||
Previously, xonsh would attempt to translate the alias from sh-lang into
|
||||
xonsh. These restrictions have been removed. For example, the following now
|
||||
works:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ source-bash 'alias eee="echo aaa \$(echo b)"'
|
||||
$ eee
|
||||
aaa b
|
||||
|
||||
* New ``ForeignShellBaseAlias``, ``ForeignShellFunctionAlias``, and
|
||||
``ForeignShellExecAlias`` classes have been added which manage foreign shell
|
||||
alias execution.
|
||||
|
||||
**Changed:**
|
||||
|
||||
* String aliases will now first be checked to see if they contain sub-expressions
|
||||
that require evaluations, such as ``@(expr)``, ``$[cmd]``, etc. If they do,
|
||||
then an ``ExecAlias`` will be constructed, rather than a simple list-of-strs
|
||||
substitutiuon alias being used. For example:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ aliases['uuu'] = "echo ccc $(echo ddd)"
|
||||
$ aliases['uuu']
|
||||
ExecAlias('echo ccc $(echo ddd)\n', filename='<exec-alias:uuu>')
|
||||
$ uuu
|
||||
ccc ddd
|
||||
|
||||
* The ``parse_aliases()`` function now requires the shell name.
|
||||
* ``ForeignShellFunctionAlias`` now inherits from ``ForeignShellBaseAlias``
|
||||
rather than ``object``.
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -1,11 +1,6 @@
|
|||
#!/usr/bin/env xonsh
|
||||
$RAISE_SUBPROC_ERROR = True
|
||||
|
||||
if 'TF_BUILD' in ${...}:
|
||||
print('TF_BUILD', repr($TF_BUILD))
|
||||
else:
|
||||
print('TF_BUILD not found')
|
||||
|
||||
run_separately = [
|
||||
'tests/test_ptk_highlight.py',
|
||||
]
|
||||
|
|
|
@ -64,7 +64,7 @@ def test_parse_aliases():
|
|||
"__XONSH_ALIAS_END__\n"
|
||||
"more filth"
|
||||
)
|
||||
obs = parse_aliases(s)
|
||||
obs = parse_aliases(s, 'bash')
|
||||
assert exp == obs
|
||||
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ def parse_funcs(s, shell, sourcer=None, extra_args=()):
|
|||
if not os.path.isabs(filename):
|
||||
filename = os.path.abspath(filename)
|
||||
wrapper = ForeignShellFunctionAlias(
|
||||
name=funcname,
|
||||
funcname=funcname,
|
||||
shell=shell,
|
||||
sourcer=sourcer,
|
||||
filename=filename,
|
||||
|
|
Loading…
Add table
Reference in a new issue