From 5074b7e922fed8276367755832e3263885c8e884 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Mon, 6 Nov 2023 23:37:46 +0100 Subject: 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 --- etc/spack/defaults/config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'etc') diff --git a/etc/spack/defaults/config.yaml b/etc/spack/defaults/config.yaml index b4d81f69da..018e8deb55 100644 --- a/etc/spack/defaults/config.yaml +++ b/etc/spack/defaults/config.yaml @@ -229,3 +229,11 @@ config: flags: # Whether to keep -Werror flags active in package builds. keep_werror: 'none' + + # A mapping of aliases that can be used to define new commands. For instance, + # `sp: spec -I` will define a new command `sp` that will execute `spec` with + # the `-I` argument. Aliases cannot override existing commands. + aliases: + concretise: concretize + containerise: containerize + rm: remove -- cgit v1.2.3-60-g2f50