commands: Colorize only if color=on is set

Commands 'columns', 'commands' and 'custom' would output color
escape sequences desipte color=off being set.
This commit is contained in:
Tomas Babej 2015-09-06 01:08:14 +02:00 committed by Paul Beckingham
parent 44afdb89e3
commit e0a808a6ba
4 changed files with 32 additions and 17 deletions

View file

@ -70,12 +70,15 @@ int CmdCommands::execute (std::string& output)
view.add (Column::factory ("string.right", STRING_COLUMN_LABEL_MISC));
view.add (Column::factory ("string.left", STRING_COLUMN_LABEL_DESC));
Color label (context.config.get ("color.label"));
view.colorHeader (label);
if (context.color ())
{
Color label (context.config.get ("color.label"));
view.colorHeader (label);
Color alternate (context.config.get ("color.alternate"));
view.colorOdd (alternate);
view.intraColorOdd (alternate);
Color alternate (context.config.get ("color.alternate"));
view.colorOdd (alternate);
view.intraColorOdd (alternate);
}
view.leftMargin (context.config.getInteger ("indent.report"));
view.extraPadding (context.config.getInteger ("row.padding"));