summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-04 17:45:44 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-04 19:50:58 +0900
commitb9f3547ae19ecbb0566cfc08994610abe9e1c78a (patch)
treee053fcd292805b75af838dd06575243ebbb1bf17
parent40e9d16dce74bdf3abb8728fcd976fe80b3d1df3 (diff)
downloadbuildstream-b9f3547ae19ecbb0566cfc08994610abe9e1c78a.tar.gz
widget.py: print_heading() now takes a styling boolean
This controls whether color is used in the output
-rw-r--r--buildstream/_frontend/widget.py8
1 files 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)