text plugin: add color support
This patch adds terminal color support to the text plugin.
The text component class accepts a new initialization parameter `color`
which you can set to one of the following strings:
never:
Never output color codes.
auto:
Output color codes if the standard output is connected to a
color-capable terminal and if the file stream to use is the standard
output.
always:
Always output color codes. This is useful to print colors even if the
standard output is not connected to a terminal, for example:
babeltrace /path/to/trace -o text.text -p color=always | less -R
The semantic of this parameter is the same as ls(1)'s and grep(1)'s
--color option.
The chosen color scheme is open to debate. In an ideal world, it should
be configurable by the component parameters, or read $LS_COLORS.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.027708 seconds and 4 git commands to generate.