From b9f3547ae19ecbb0566cfc08994610abe9e1c78a Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Tue, 4 Jul 2017 17:45:44 +0900 Subject: widget.py: print_heading() now takes a styling boolean This controls whether color is used in the output --- buildstream/_frontend/widget.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py index d0651918f..58ee87867 100644 --- a/buildstream/_frontend/widget.py +++ b/buildstream/_frontend/widget.py @@ -405,9 +405,13 @@ class LogLine(Widget): # and so on. # # Args: + # pipeline (Pipeline): The pipeline to print the heading of # log_file (file): An optional file handle for additional logging + # variant (str): The selected variant for the pipeline target + # deps (list): Optional list of elements, default is to use the whole pipeline + # styling (bool): Whether to enable ansi escape codes in the output # - def print_heading(self, pipeline, variant, log_file, deps=None): + def print_heading(self, pipeline, variant, log_file, deps=None, styling=False): context = pipeline.context project = pipeline.project starttime = datetime.datetime.now() @@ -451,7 +455,7 @@ class LogLine(Widget): # Separator line before following output text += self.format_profile.fmt("~" * 79 + '\n') - click.echo(text, nl=False) + click.echo(text, color=styling, nl=False) if log_file: click.echo(text, file=log_file, color=False, nl=False) -- cgit v1.2.1