text plugin: add color support
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 11 Feb 2017 01:31:56 +0000 (20:31 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:38 +0000 (12:57 -0400)
commitad96d93646ede91f93d3630b7e6d655f0edf1b3b
tree62057383193a25c6d48f16ff99eb7e08454e7e26
parentebba3338a91f2b439a50d41f97e9fb4b76cbe29f
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>
common/common.c
include/babeltrace/common-internal.h
plugins/text/Makefile.am
plugins/text/print.c
plugins/text/text.c
plugins/text/text.h
This page took 0.026871 seconds and 4 git commands to generate.