Skip to content

Commit 0dbb010

Browse files
authored
Update metadata.py
1 parent aa20fa8 commit 0dbb010

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/anemoi/utils/commands/metadata.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ def add_arguments(self, command_parser: ArgumentParser) -> None:
139139
command_parser.add_argument(
140140
"--json",
141141
action="store_true",
142-
help="Use the JSON format with ``--dump``, ``--view`` and ``--edit``.",
142+
help="Use the JSON format with ``--dump``, ``--view``, ``--get`` and ``--edit``.",
143143
)
144144

145145
command_parser.add_argument(
146146
"--yaml",
147147
action="store_true",
148-
help="Use the YAML format with ``--dump``, ``--view`` and ``--edit``.",
148+
help="Use the YAML format with ``--dump``, ``--view``, ``--get`` and ``--edit``.",
149149
)
150150

151151
def run(self, args: Namespace) -> None:
@@ -335,7 +335,10 @@ def get(self, args: Namespace) -> None:
335335

336336
print(f"Metadata values for {args.get}: ", end="\n" if isinstance(metadata, (dict, list)) else "")
337337
if isinstance(metadata, dict):
338-
pprint(metadata, indent=2, compact=True)
338+
if args.yaml:
339+
print(yaml.dump(metadata, indent=2, sort_keys=True))
340+
return
341+
print(json.dumps(metadata, indent=2, sort_keys=True))
339342
else:
340343
print(metadata)
341344

0 commit comments

Comments
 (0)