From 7b27591321fca14c519e75a3ab76a7e231347594 Mon Sep 17 00:00:00 2001 From: Peter Scheibel Date: Thu, 18 Jan 2024 00:21:17 -0800 Subject: New command: `spack config change` (#41147) Like `spack change` for specs in environments, this can e.g. replace `examplespec+debug` with `examplespec~debug` in a `require:` section. Example behavior for a config like: ``` packages: foo: require: - spec: +debug ``` * `spack config change packages:foo:require:~debug` replaces `+debug` with `~debug` * `spack config change packages:foo:require:@1.1` adds a requirement to the list * `spack config change packages:bar:require:~debug` adds a requirement --- share/spack/spack-completion.bash | 11 ++++++++++- share/spack/spack-completion.fish | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'share') diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 0c002aafc3..abc6db10d1 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -824,7 +824,7 @@ _spack_config() { then SPACK_COMPREPLY="-h --help --scope" else - SPACK_COMPREPLY="get blame edit list add prefer-upstream remove rm update revert" + SPACK_COMPREPLY="get blame edit list add change prefer-upstream remove rm update revert" fi } @@ -868,6 +868,15 @@ _spack_config_add() { fi } +_spack_config_change() { + if $list_options + then + SPACK_COMPREPLY="-h --help --match-spec" + else + SPACK_COMPREPLY="" + fi +} + _spack_config_prefer_upstream() { SPACK_COMPREPLY="-h --help --local" } diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish index 1f597badb4..10c92bc6f1 100755 --- a/share/spack/spack-completion.fish +++ b/share/spack/spack-completion.fish @@ -1165,6 +1165,7 @@ complete -c spack -n '__fish_spack_using_command_pos 0 config' -f -a blame -d 'p complete -c spack -n '__fish_spack_using_command_pos 0 config' -f -a edit -d 'edit configuration file' complete -c spack -n '__fish_spack_using_command_pos 0 config' -f -a list -d 'list configuration sections' complete -c spack -n '__fish_spack_using_command_pos 0 config' -f -a add -d 'add configuration parameters' +complete -c spack -n '__fish_spack_using_command_pos 0 config' -f -a change -d 'swap variants etc. on specs in config' complete -c spack -n '__fish_spack_using_command_pos 0 config' -f -a prefer-upstream -d 'set package preferences from upstream' complete -c spack -n '__fish_spack_using_command_pos 0 config' -f -a remove -d 'remove configuration parameters' complete -c spack -n '__fish_spack_using_command_pos 0 config' -f -a rm -d 'remove configuration parameters' @@ -1208,6 +1209,14 @@ complete -c spack -n '__fish_spack_using_command config add' -s h -l help -d 'sh complete -c spack -n '__fish_spack_using_command config add' -s f -l file -r -f -a file complete -c spack -n '__fish_spack_using_command config add' -s f -l file -r -d 'file from which to set all config values' +# spack config change +set -g __fish_spack_optspecs_spack_config_change h/help match-spec= +complete -c spack -n '__fish_spack_using_command_pos 0 config change' -f -a '(__fish_spack_colon_path)' +complete -c spack -n '__fish_spack_using_command config change' -s h -l help -f -a help +complete -c spack -n '__fish_spack_using_command config change' -s h -l help -d 'show this help message and exit' +complete -c spack -n '__fish_spack_using_command config change' -l match-spec -r -f -a match_spec +complete -c spack -n '__fish_spack_using_command config change' -l match-spec -r -d 'only change constraints that match this' + # spack config prefer-upstream set -g __fish_spack_optspecs_spack_config_prefer_upstream h/help local complete -c spack -n '__fish_spack_using_command config prefer-upstream' -s h -l help -f -a help -- cgit v1.2.3-70-g09d2