summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Becker <becker33@llnl.gov>2020-11-11 22:13:51 -0800
committerGitHub <noreply@github.com>2020-11-11 22:13:51 -0800
commit527a81b469cf3df12e4b8c3bcd8609b2d55db2f3 (patch)
treefd7e09ab99e20cbca3c899af127e5a167752506d /lib
parentb9f20c2351a4a49ef3a0d7e04ae036ca8921e9cd (diff)
downloadspack-527a81b469cf3df12e4b8c3bcd8609b2d55db2f3.tar.gz
spack-527a81b469cf3df12e4b8c3bcd8609b2d55db2f3.tar.bz2
spack-527a81b469cf3df12e4b8c3bcd8609b2d55db2f3.tar.xz
spack-527a81b469cf3df12e4b8c3bcd8609b2d55db2f3.zip
Keep output machine readable using `spack find --format` in an env (#19698)
Currently, full JSON output is the only machine readable option for `spack find` in an environment. `spack find --format` is also designed to be machine readable, but we print extra headers in environments. -[x] don't print headers in `spack find` output when in an environment
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/find.py5
-rw-r--r--lib/spack/spack/test/cmd/find.py1
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py
index db229aca7e..d9d51b853c 100644
--- a/lib/spack/spack/cmd/find.py
+++ b/lib/spack/spack/cmd/find.py
@@ -235,8 +235,9 @@ def find(parser, args):
if args.json:
cmd.display_specs_as_json(results, deps=args.deps)
else:
- if env:
- display_env(env, args, decorator)
+ if not args.format:
+ if env:
+ display_env(env, args, decorator)
if sys.stdout.isatty() and args.groups:
tty.msg("%s" % plural(len(results), 'installed package'))
cmd.display_specs(
diff --git a/lib/spack/spack/test/cmd/find.py b/lib/spack/spack/test/cmd/find.py
index 8d3c68d31a..9d2203aaaf 100644
--- a/lib/spack/spack/test/cmd/find.py
+++ b/lib/spack/spack/test/cmd/find.py
@@ -209,6 +209,7 @@ def test_find_format(database, config):
output = find('--format', '{name}-{version}-{compiler.name}-{^mpi.name}',
'mpileaks')
+ assert "installed package" not in output
assert set(output.strip().split('\n')) == set([
"mpileaks-2.3-gcc-zmpi",
"mpileaks-2.3-gcc-mpich",