diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2024-10-04 17:43:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-04 17:43:10 -0700 |
commit | d763d6f7388216b333bff77d8f79438667003ee8 (patch) | |
tree | 211648b6776b960c2e520585320f10c5c4477920 /share | |
parent | d87464e9955456c2bcdffb9c3b1aa39f3a8f252b (diff) | |
download | spack-d763d6f7388216b333bff77d8f79438667003ee8.tar.gz spack-d763d6f7388216b333bff77d8f79438667003ee8.tar.bz2 spack-d763d6f7388216b333bff77d8f79438667003ee8.tar.xz spack-d763d6f7388216b333bff77d8f79438667003ee8.zip |
`gc`: restrict to specific specs (#46790)
`spack gc` has so far been a global or environment-specific thing.
This adds the ability to restrict garbage collection to specific specs,
e.g. if you *just* want to get rid of all your unused python installations,
you could write:
```console
spack gc python
```
- [x] add `constraint` arg to `spack gc`
- [x] add a simple test
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Diffstat (limited to 'share')
-rw-r--r-- | share/spack/spack-completion.bash | 7 | ||||
-rw-r--r-- | share/spack/spack-completion.fish | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 7546c6ade6..0cadf7b12d 100644 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1195,7 +1195,12 @@ _spack_find() { } _spack_gc() { - SPACK_COMPREPLY="-h --help -E --except-any-environment -e --except-environment -b --keep-build-dependencies -y --yes-to-all" + if $list_options + then + SPACK_COMPREPLY="-h --help -E --except-any-environment -e --except-environment -b --keep-build-dependencies -y --yes-to-all" + else + _installed_packages + fi } _spack_gpg() { diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish index 43616c2fae..172af7e8f3 100644 --- a/share/spack/spack-completion.fish +++ b/share/spack/spack-completion.fish @@ -1817,6 +1817,7 @@ complete -c spack -n '__fish_spack_using_command find' -l end-date -r -d 'latest # spack gc set -g __fish_spack_optspecs_spack_gc h/help E/except-any-environment e/except-environment= b/keep-build-dependencies y/yes-to-all +complete -c spack -n '__fish_spack_using_command_pos_remainder 0 gc' -f -a '(__fish_spack_installed_specs)' complete -c spack -n '__fish_spack_using_command gc' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command gc' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command gc' -s E -l except-any-environment -f -a except_any_environment |