From a557ff9944e1a0191169f09d35de301fcd82bf09 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Thu, 18 Oct 2012 16:59:52 +0200 Subject: [PATCH] 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. --- format.py | 16 ++++++++++++++++ gitinspector.py | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/format.py b/format.py index d48fa6d..f388783 100644 --- a/format.py +++ b/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("") + +def output_footer(): + if __selected_format__ == "html": + pass + elif __selected_format__ == "text": + pass + else: + print("") def call_output_function(html_function, text_function, xml_function, *parameters): if __selected_format__ == "html": diff --git a/gitinspector.py b/gitinspector.py index d80beaa..fcdb3aa 100755 --- a/gitinspector.py +++ b/gitinspector.py @@ -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__":