mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 00:28:25 +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
|
@ -33,6 +33,22 @@ def select(format):
|
|||
__selected_format__ = format
|
||||
|
||||
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):
|
||||
if __selected_format__ == "html":
|
||||
|
|
|
@ -50,10 +50,11 @@ class Runner:
|
|||
terminal.skip_escapes(not sys.stdout.isatty())
|
||||
previous_directory = os.getcwd()
|
||||
os.chdir(self.repo)
|
||||
format.output_header()
|
||||
format.call_output_function(changes.output_html, changes.output_text, changes.output_xml, self.hard)
|
||||
|
||||
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:
|
||||
timeline.output(changes.get(self.hard), self.useweeks)
|
||||
|
@ -70,6 +71,7 @@ class Runner:
|
|||
if self.list_file_types:
|
||||
extensions.output()
|
||||
|
||||
format.output_footer()
|
||||
os.chdir(previous_directory)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue