mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 08:38:26 +01:00
Implemented output_header/footer() in the format module.
This enables us to fetch XML output from multiple sources in-between the footer and header. These functions are called at the beginning and end when gitinspector runs.
This commit is contained in:
parent
d9c94b53d6
commit
a557ff9944
2 changed files with 19 additions and 1 deletions
16
format.py
16
format.py
|
@ -34,6 +34,22 @@ def select(format):
|
||||||
|
|
||||||
return format in __available_formats__
|
return format in __available_formats__
|
||||||
|
|
||||||
|
def output_header():
|
||||||
|
if __selected_format__ == "html":
|
||||||
|
pass
|
||||||
|
elif __selected_format__ == "text":
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print("<gitinspector>")
|
||||||
|
|
||||||
|
def output_footer():
|
||||||
|
if __selected_format__ == "html":
|
||||||
|
pass
|
||||||
|
elif __selected_format__ == "text":
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print("</gitinspector>")
|
||||||
|
|
||||||
def call_output_function(html_function, text_function, xml_function, *parameters):
|
def call_output_function(html_function, text_function, xml_function, *parameters):
|
||||||
if __selected_format__ == "html":
|
if __selected_format__ == "html":
|
||||||
template_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "html.template")
|
template_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "html.template")
|
||||||
|
|
|
@ -50,10 +50,11 @@ class Runner:
|
||||||
terminal.skip_escapes(not sys.stdout.isatty())
|
terminal.skip_escapes(not sys.stdout.isatty())
|
||||||
previous_directory = os.getcwd()
|
previous_directory = os.getcwd()
|
||||||
os.chdir(self.repo)
|
os.chdir(self.repo)
|
||||||
|
format.output_header()
|
||||||
format.call_output_function(changes.output_html, changes.output_text, changes.output_xml, self.hard)
|
format.call_output_function(changes.output_html, changes.output_text, changes.output_xml, self.hard)
|
||||||
|
|
||||||
if changes.get(self.hard).get_commits():
|
if changes.get(self.hard).get_commits():
|
||||||
blame.output(self.hard)
|
format.call_output_function(blame.output_html, blame.output_text, blame.output_xml, self.hard)
|
||||||
|
|
||||||
if self.timeline:
|
if self.timeline:
|
||||||
timeline.output(changes.get(self.hard), self.useweeks)
|
timeline.output(changes.get(self.hard), self.useweeks)
|
||||||
|
@ -70,6 +71,7 @@ class Runner:
|
||||||
if self.list_file_types:
|
if self.list_file_types:
|
||||||
extensions.output()
|
extensions.output()
|
||||||
|
|
||||||
|
format.output_footer()
|
||||||
os.chdir(previous_directory)
|
os.chdir(previous_directory)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue