Bug 1229178: modify --json output to contain a single object r=mshal

MozReview-Commit-ID: DNlxPfQh3o0
This commit is contained in:
Dustin J. Mitchell
2016-06-09 11:15:23 -05:00
parent fad8ae2b71
commit 6d42f5dc86
2 changed files with 17 additions and 11 deletions

View File

@@ -37,7 +37,7 @@ class ShowTaskGraphSubCommand(SubCommand):
help="include debug-level logging output"),
CommandArgument('--json', '-J', action="store_const",
dest="format", const="json",
help="Output each task in the task graph as a JSON object"),
help="Output task graph as a JSON object"),
CommandArgument('--labels', '-L', action="store_const",
dest="format", const="labels",
help="Output the label for each task in the task graph (default)"),
@@ -199,10 +199,8 @@ class MachCommands(MachCommandBase):
print(label)
def show_taskgraph_json(self, taskgraph):
# JSON output is a sequence of JSON objects, rather than a single object, so
# disassemble the dictionary
for task in taskgraph.to_json().itervalues():
print(json.dumps(task))
print(json.dumps(taskgraph.to_json(),
sort_keys=True, indent=2, separators=(',', ': ')))
@CommandProvider