From 9b3a5b674e9ade510a801153801765a141b8c95e Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Tue, 3 Nov 2015 22:42:23 +0100 Subject: [PATCH] Some output was missing in the JSON output. Repository names, gitinspector version and report date were all missing from the output when JSON was selected. --- gitinspector/format.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gitinspector/format.py b/gitinspector/format.py index 2c33bdf..92c221c 100644 --- a/gitinspector/format.py +++ b/gitinspector/format.py @@ -105,6 +105,20 @@ def output_header(repos): hide_minor_rows=_("Hide rows with minor work"))) elif __selected_format__ == "json": print("{\n\t\"gitinspector\": {") + print("\t\t\"version\": \"" + version.__version__ + "\",") + + if len(repos) <= 1: + print("\t\t\"repository\": \"" + repos[0].name + "\",") + else: + repos_json = "\t\t\"repositories\": [ " + + for repo in repos: + repos_json += "\"" + repo.name + "\", " + + print(repos_json[:-2] + " ],") + + print("\t\t\"report_date\": \"" + time.strftime("%Y/%m/%d") + "\",") + elif __selected_format__ == "xml": print("") print("\t" + version.__version__ + "")