Add a warning to the docs about $args in ExecAlias (#5033)

This commit is contained in:
Tobias Becker 2023-01-17 19:05:39 +01:00 committed by GitHub
parent 81e3bdd207
commit d173ad7f3b
Failed to generate hash of commit

View file

@ -1264,6 +1264,16 @@ or by the index in ``$arg<n>`` environment variables.
>>> aliases['piu'] = 'pip install -U @($args)'
>>> aliases['cdls'] = 'cd $arg0 && ls'
.. warning:: That means, if you need ``@()`` in your alias, you can't rely on
automatic argument handling anymore. Any alias involving it needs
to add ``$args`` at the end manually if you don't want your alias
to ignore supplied arguments.
.. code-block:: xonshcon
>>> aliases['careful'] = 'echo @("all args will be ignored")'
>>> aliases['better'] = 'echo @("the arguments are: ") @($args)'
.. note::
To add multiple aliases there is merge operator: ``aliases |= {'e': 'echo', 'g': 'git'}``.