Skip to content
Snippets Groups Projects
Commit 06baf446 authored by Eric Müller's avatar Eric Müller :mountain_bicyclist:
Browse files

fix(cmd spec -y): add yaml doc separators (---)

parent 6b3ed3d9
No related branches found
No related tags found
1 merge request!1Prepare for fetch cache
...@@ -108,11 +108,16 @@ def spec(parser, args): ...@@ -108,11 +108,16 @@ def spec(parser, args):
else: else:
tty.die("spack spec requires at least one spec or an active environment") tty.die("spack spec requires at least one spec or an active environment")
first_doc = True
for input, output in specs: for input, output in specs:
# With -y, just print YAML to output. # With -y, just print YAML to output.
if args.format: if args.format:
if args.format == "yaml": if args.format == "yaml":
# use write because to_yaml already has a newline. # use write because to_yaml already has a newline.
if first_doc:
first_doc = False
else:
sys.stdout.write("---\n")
sys.stdout.write(output.to_yaml(hash=ht.dag_hash)) sys.stdout.write(output.to_yaml(hash=ht.dag_hash))
elif args.format == "json": elif args.format == "json":
print(output.to_json(hash=ht.dag_hash)) print(output.to_json(hash=ht.dag_hash))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment