mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CmdShow: Color only used for tty
This commit is contained in:
parent
c4f7e1a869
commit
30a2ab8ea8
1 changed files with 11 additions and 6 deletions
|
@ -265,11 +265,16 @@ int CmdShow::execute (std::string& output)
|
||||||
view.add (Column::factory ("string", STRING_CMD_SHOW_CONF_VAR));
|
view.add (Column::factory ("string", STRING_CMD_SHOW_CONF_VAR));
|
||||||
view.add (Column::factory ("string", STRING_CMD_SHOW_CONF_VALUE));
|
view.add (Column::factory ("string", STRING_CMD_SHOW_CONF_VALUE));
|
||||||
|
|
||||||
Color error (context.config.get ("color.error"));
|
Color error;
|
||||||
Color warning (context.config.get ("color.warning"));
|
Color warning;
|
||||||
Color label (context.config.get ("color.label"));
|
if (context.color ())
|
||||||
|
{
|
||||||
|
error = Color (context.config.get ("color.error"));
|
||||||
|
warning = Color (context.config.get ("color.warning"));
|
||||||
|
|
||||||
|
Color label (context.config.get ("color.label"));
|
||||||
view.colorHeader (label);
|
view.colorHeader (label);
|
||||||
|
}
|
||||||
|
|
||||||
bool issue_error = false;
|
bool issue_error = false;
|
||||||
bool issue_warning = false;
|
bool issue_warning = false;
|
||||||
|
@ -326,7 +331,7 @@ int CmdShow::execute (std::string& output)
|
||||||
{
|
{
|
||||||
out << STRING_CMD_SHOW_DIFFER << "\n";
|
out << STRING_CMD_SHOW_DIFFER << "\n";
|
||||||
|
|
||||||
if (context.color ())
|
if (context.color () && warning.nontrivial ())
|
||||||
out << " "
|
out << " "
|
||||||
<< format (STRING_CMD_SHOW_DIFFER_COLOR, warning.colorize ("color"))
|
<< format (STRING_CMD_SHOW_DIFFER_COLOR, warning.colorize ("color"))
|
||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
|
@ -340,7 +345,7 @@ int CmdShow::execute (std::string& output)
|
||||||
for (auto& i : unrecognized)
|
for (auto& i : unrecognized)
|
||||||
out << " " << i << "\n";
|
out << " " << i << "\n";
|
||||||
|
|
||||||
if (context.color ())
|
if (context.color () && error.nontrivial ())
|
||||||
out << "\n" << format (STRING_CMD_SHOW_DIFFER_COLOR, error.colorize ("color"));
|
out << "\n" << format (STRING_CMD_SHOW_DIFFER_COLOR, error.colorize ("color"));
|
||||||
|
|
||||||
out << "\n\n";
|
out << "\n\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue