aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mlog.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/mlog.py')
-rw-r--r--mesonbuild/mlog.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index d17b889..3baa07a 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -57,17 +57,21 @@ def shutdown():
class AnsiDecorator:
plain_code = "\033[0m"
- def __init__(self, text, code):
+ def __init__(self, text, code, quoted=False):
self.text = text
self.code = code
+ self.quoted = quoted
def get_text(self, with_codes):
+ text = self.text
if with_codes:
- return self.code + self.text + AnsiDecorator.plain_code
- return self.text
+ text = self.code + self.text + AnsiDecorator.plain_code
+ if self.quoted:
+ text = '"{}"'.format(text)
+ return text
-def bold(text):
- return AnsiDecorator(text, "\033[1m")
+def bold(text, quoted=False):
+ return AnsiDecorator(text, "\033[1m", quoted=quoted)
def red(text):
return AnsiDecorator(text, "\033[1;31m")