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.
This commit is contained in:
Adam Waldenberg 2015-11-03 22:42:23 +01:00
parent 87fd5b467f
commit 9b3a5b674e
1 changed files with 14 additions and 0 deletions

View File

@ -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("<gitinspector>")
print("\t<version>" + version.__version__ + "</version>")