commands: spack load --list alias for spack find --loaded (#27184)

See #25249 and https://github.com/spack/spack/pull/27159#issuecomment-958163679.
This adds `spack load --list` as an alias for `spack find --loaded`.  The new command is
not as powerful as `spack find --loaded`, as you can't combine it with all the queries or
formats that `spack find` provides.  However, it is more intuitively located in the command
structure in that it appears in the output of `spack load --help`.

The idea here is that people can use `spack load --list`  for simple stuff but fall back to
`spack find --loaded` if they need more.

- add help to `spack load --list` that references `spack find`
- factor some parts of `spack find` out to be called from `spack load`
- add shell tests
- update docs

Co-authored-by: Peter Josef Scheibel <scheibel1@llnl.gov>
Co-authored-by: Richarda Butler <39577672+RikkiButler20@users.noreply.github.com>
This commit is contained in:
Todd Gamblin
2021-11-05 00:58:29 -07:00
committed by GitHub
parent bfbf9deb74
commit e13e697067
10 changed files with 64 additions and 11 deletions

View File

@@ -337,6 +337,9 @@ set _a_ld $_a_loc"/lib"
spt_contains "set -gx LD_LIBRARY_PATH $_b_ld" spack -m load --only package --fish b
spt_succeeds spack -m load b
set LIST_CONTENT (spack -m load b; spack load --list)
spt_contains "b@" echo $LIST_CONTENT
spt_does_not_contain "a@" echo $LIST_CONTENT
# test a variable MacOS clears and one it doesn't for recursive loads
spt_contains "set -gx LD_LIBRARY_PATH $_a_ld:$_b_ld" spack -m load --fish a
spt_succeeds spack -m load --only dependencies a

View File

@@ -106,6 +106,9 @@ contains "usage: spack module " spack -m module
title 'Testing `spack load`'
contains "export PATH=$(spack -m location -i b)/bin" spack -m load --only package --sh b
succeeds spack -m load b
LIST_CONTENT=`spack -m load b; spack load --list`
contains "b@" echo $LIST_CONTENT
does_not_contain "a@" echo $LIST_CONTENT
fails spack -m load -l
# test a variable MacOS clears and one it doesn't for recursive loads
contains "export PATH=$(spack -m location -i a)/bin:$(spack -m location -i b)/bin" spack -m load --sh a