mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
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:
parent
44afdb89e3
commit
e0a808a6ba
4 changed files with 32 additions and 17 deletions
|
@ -123,6 +123,8 @@
|
|||
(thanks to Leon Feng).
|
||||
- TW-1647 descriptions that are stringified ids (thanks to Daniel Shahaf).
|
||||
- TW-1648 Typo in Documentation (thanks to Simon W. Jackson).
|
||||
- TW-1649 'columns' colorizes output when stdout is a pipe (thanks to Daniel
|
||||
Shahaf).
|
||||
- TW-1651 Provide opt-out of filter parser's id treatment (thanks to Daniel
|
||||
Shahaf).
|
||||
- TW-1652 task rm misparsed (thanks to Daniel Shahaf).
|
||||
|
|
|
@ -76,12 +76,15 @@ int CmdColumns::execute (std::string& output)
|
|||
formats.add (Column::factory ("string", STRING_COLUMN_LABEL_STYLES));
|
||||
formats.add (Column::factory ("string", STRING_COLUMN_LABEL_EXAMPLES));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
formats.colorHeader (label);
|
||||
if (context.color ())
|
||||
{
|
||||
Color label (context.config.get ("color.label"));
|
||||
formats.colorHeader (label);
|
||||
|
||||
Color alternate (context.config.get ("color.alternate"));
|
||||
formats.colorOdd (alternate);
|
||||
formats.intraColorOdd (alternate);
|
||||
Color alternate (context.config.get ("color.alternate"));
|
||||
formats.colorOdd (alternate);
|
||||
formats.intraColorOdd (alternate);
|
||||
}
|
||||
|
||||
for (auto& name : names)
|
||||
{
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -129,15 +129,22 @@ int CmdCustom::execute (std::string& output)
|
|||
view.extraPadding (context.config.getInteger ("row.padding"));
|
||||
view.intraPadding (context.config.getInteger ("column.padding"));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
if (context.color ())
|
||||
{
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
Color label_sort (context.config.get ("color.label.sort"));
|
||||
view.colorSortHeader (label_sort);
|
||||
Color label_sort (context.config.get ("color.label.sort"));
|
||||
view.colorSortHeader (label_sort);
|
||||
|
||||
Color alternate (context.config.get ("color.alternate"));
|
||||
view.colorOdd (alternate);
|
||||
view.intraColorOdd (alternate);
|
||||
// If an alternating row color is specified, notify the table.
|
||||
Color alternate (context.config.get ("color.alternate"));
|
||||
if (alternate.nontrivial ())
|
||||
{
|
||||
view.colorOdd (alternate);
|
||||
view.intraColorOdd (alternate);
|
||||
}
|
||||
}
|
||||
|
||||
// Capture columns that are sorted.
|
||||
std::vector <std::string> sortColumns;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue