The XML output now prints repositories in a proper XML list.

If one repository is found, the following format is used:

<repository>name</repository>

If multiple repositories are found, the following format is used:

<repositories>
	<repository>name</repository>
	<repository>name</repository>
	...
</repositories>
This commit is contained in:
Adam Waldenberg 2015-11-03 23:00:17 +01:00
parent 4d6ecd3123
commit 26f77e0ee4

View file

@ -122,7 +122,17 @@ def output_header(repos):
elif __selected_format__ == "xml": elif __selected_format__ == "xml":
print("<gitinspector>") print("<gitinspector>")
print("\t<version>" + version.__version__ + "</version>") print("\t<version>" + version.__version__ + "</version>")
print("\t<repository>" + repos_string + "</repository>")
if len(repos) <= 1:
print("\t<repository>" + repos_string + "</repository>")
else:
print("\t<repositories>")
for repo in repos:
print("\t\t<repository>" + repo.name + "</repository>")
print("\t</repositories>")
print("\t<report-date>" + time.strftime("%Y/%m/%d") + "</report-date>") print("\t<report-date>" + time.strftime("%Y/%m/%d") + "</report-date>")
else: else:
print(textwrap.fill(_(INFO_ONE_REPOSITORY if len(repos) <= 1 else INFO_MANY_REPOSITORIES).format( print(textwrap.fill(_(INFO_ONE_REPOSITORY if len(repos) <= 1 else INFO_MANY_REPOSITORIES).format(