diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2021-01-21 12:33:27 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-01-21 08:54:35 -0500 |
commit | adb1b2f3f6ad54b346348ec6e5b8d96f2f7ba0a6 (patch) | |
tree | e18fe1b3cfb0f32b76ecaa456fdd3b0a2599b53d /mesonbuild/mlog.py | |
parent | 021068a8b7461a62ed4ce68ab558bc94786e0550 (diff) | |
download | meson-adb1b2f3f6ad54b346348ec6e5b8d96f2f7ba0a6.zip meson-adb1b2f3f6ad54b346348ec6e5b8d96f2f7ba0a6.tar.gz meson-adb1b2f3f6ad54b346348ec6e5b8d96f2f7ba0a6.tar.bz2 |
interpreter: accept external programs and dependencies for summary
Diffstat (limited to 'mesonbuild/mlog.py')
-rw-r--r-- | mesonbuild/mlog.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py index a6aa2b5..20794df 100644 --- a/mesonbuild/mlog.py +++ b/mesonbuild/mlog.py @@ -136,6 +136,18 @@ class AnsiDecorator: def __str__(self) -> str: return self.get_text(colorize_console()) + +class AnsiText: + def __init__(self, *args: T.List[T.Union[str, AnsiDecorator]]): + self.args = args + + def __len__(self) -> int: + return sum((len(x) for x in self.args)) + + def __str__(self) -> str: + return ''.join((str(x) for x in self.args)) + + def bold(text: str, quoted: bool = False) -> AnsiDecorator: return AnsiDecorator(text, "\033[1m", quoted=quoted) |