summaryrefslogtreecommitdiff
path: root/lib/spack/docs/config_yaml.rst
diff options
context:
space:
mode:
authorMichael Kuhn <michael.kuhn@ovgu.de>2023-11-06 23:37:46 +0100
committerGitHub <noreply@github.com>2023-11-06 14:37:46 -0800
commit5074b7e922fed8276367755832e3263885c8e884 (patch)
treedc6579374b5f2cbb1bcc2dfd39675bc01267ae62 /lib/spack/docs/config_yaml.rst
parent461eb944bdff103b8e347c272afb2bcbd31f9723 (diff)
downloadspack-5074b7e922fed8276367755832e3263885c8e884.tar.gz
spack-5074b7e922fed8276367755832e3263885c8e884.tar.bz2
spack-5074b7e922fed8276367755832e3263885c8e884.tar.xz
spack-5074b7e922fed8276367755832e3263885c8e884.zip
Add support for aliases (#17229)
Add a new config section: `config:aliases`, which is a dictionary mapping aliases to commands. For instance: ```yaml config: aliases: sp: spec -I ``` will define a new command `sp` that will execute `spec` with the `-I` argument. Aliases cannot override existing commands, and this is ensured with a test. We cannot currently alias subcommands. Spack will warn about any aliases containing a space, but will not error, which leaves room for subcommand aliases in the future. --------- Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
Diffstat (limited to 'lib/spack/docs/config_yaml.rst')
-rw-r--r--lib/spack/docs/config_yaml.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/spack/docs/config_yaml.rst b/lib/spack/docs/config_yaml.rst
index 294f7c3436..d54977beba 100644
--- a/lib/spack/docs/config_yaml.rst
+++ b/lib/spack/docs/config_yaml.rst
@@ -304,3 +304,17 @@ To work properly, this requires your terminal to reset its title after
Spack has finished its work, otherwise Spack's status information will
remain in the terminal's title indefinitely. Most terminals should already
be set up this way and clear Spack's status information.
+
+-----------
+``aliases``
+-----------
+
+Aliases can be used to define new Spack commands. They can be either shortcuts
+for longer commands or include specific arguments for convenience. For instance,
+if users want to use ``spack install``'s ``-v`` argument all the time, they can
+create a new alias called ``inst`` that will always call ``install -v``:
+
+.. code-block:: yaml
+
+ aliases:
+ inst: install -v