changeset 16513:aa252059a98f stable

alias: fix shell alias documentation (issue3374) Described behaviour was the one before shell alias argument handling was reworked by f853873fc66d mid-2010.
author Patrick Mezard <patrick@mezard.eu>
date Tue, 24 Apr 2012 14:34:54 +0200
parents c58bdecdb800
children 363e808de349
files mercurial/help/config.txt
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help/config.txt	Tue Apr 24 13:05:38 2012 +0200
+++ b/mercurial/help/config.txt	Tue Apr 24 14:34:54 2012 +0200
@@ -211,7 +211,7 @@
 shell alias. A shell alias is executed with the shell and will let you
 run arbitrary commands. As an example, ::
 
-   echo = !echo
+   echo = !echo $@
 
 will let you do ``hg echo foo`` to have ``foo`` printed in your
 terminal. A better example might be::
@@ -221,11 +221,17 @@
 which will make ``hg purge`` delete all unknown files in the
 repository in the same manner as the purge extension.
 
-Shell aliases are executed in an environment where ``$HG`` expand to
+Positional arguments like ``$1``, ``$2``, etc. in the alias definition
+expand to the command arguments. Unmatched arguments are
+removed. ``$0`` expands to the alias name and ``$@`` expands to all
+arguments separated by a space. These expansions happen before the
+command is passed to the shell.
+
+Shell aliases are executed in an environment where ``$HG`` expands to
 the path of the Mercurial that was used to execute the alias. This is
 useful when you want to call further Mercurial commands in a shell
 alias, as was done above for the purge alias. In addition,
-``$HG_ARGS`` expand to the arguments given to Mercurial. In the ``hg
+``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
 
 .. note:: Some global configuration options such as ``-R`` are