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
This commit is contained in:
Greg Becker 2020-11-11 22:13:51 -08:00 committed by GitHub
parent b9f20c2351
commit 527a81b469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -235,6 +235,7 @@ def find(parser, args):
if args.json: if args.json:
cmd.display_specs_as_json(results, deps=args.deps) cmd.display_specs_as_json(results, deps=args.deps)
else: else:
if not args.format:
if env: if env:
display_env(env, args, decorator) display_env(env, args, decorator)
if sys.stdout.isatty() and args.groups: if sys.stdout.isatty() and args.groups:

View File

@ -209,6 +209,7 @@ def test_find_format(database, config):
output = find('--format', '{name}-{version}-{compiler.name}-{^mpi.name}', output = find('--format', '{name}-{version}-{compiler.name}-{^mpi.name}',
'mpileaks') 'mpileaks')
assert "installed package" not in output
assert set(output.strip().split('\n')) == set([ assert set(output.strip().split('\n')) == set([
"mpileaks-2.3-gcc-zmpi", "mpileaks-2.3-gcc-zmpi",
"mpileaks-2.3-gcc-mpich", "mpileaks-2.3-gcc-mpich",