mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Merge branch 'config-highlight' into 1.9.1
This commit is contained in:
commit
846d9bfd83
2 changed files with 50 additions and 36 deletions
|
@ -1,5 +1,9 @@
|
||||||
|
|
||||||
------ current release ---------------------------
|
------ current release ---------------------------
|
||||||
|
2.0.0 ()
|
||||||
|
+ The 'config' command now highlights problems in color.
|
||||||
|
|
||||||
|
------ old releases ------------------------------
|
||||||
|
|
||||||
1.9.1 ()
|
1.9.1 ()
|
||||||
|
|
||||||
|
|
|
@ -664,41 +664,6 @@ int handleConfig (std::string &outs)
|
||||||
std::vector <std::string> all;
|
std::vector <std::string> all;
|
||||||
context.config.all (all);
|
context.config.all (all);
|
||||||
|
|
||||||
// Create a table for output.
|
|
||||||
Table table;
|
|
||||||
table.setTableWidth (width);
|
|
||||||
table.setDateFormat (context.config.get ("dateformat"));
|
|
||||||
table.addColumn ("Config variable");
|
|
||||||
table.addColumn ("Value");
|
|
||||||
|
|
||||||
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
|
||||||
{
|
|
||||||
table.setColumnUnderline (0);
|
|
||||||
table.setColumnUnderline (1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
table.setTableDashedUnderline ();
|
|
||||||
|
|
||||||
table.setColumnWidth (0, Table::minimum);
|
|
||||||
table.setColumnWidth (1, Table::flexible);
|
|
||||||
table.setColumnJustification (0, Table::left);
|
|
||||||
table.setColumnJustification (1, Table::left);
|
|
||||||
table.sortOn (0, Table::ascendingCharacter);
|
|
||||||
|
|
||||||
foreach (i, all)
|
|
||||||
{
|
|
||||||
std::string value = context.config.get (*i);
|
|
||||||
int row = table.addRow ();
|
|
||||||
table.addCell (row, 0, *i);
|
|
||||||
table.addCell (row, 1, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Color bold ("bold");
|
|
||||||
|
|
||||||
out << std::endl
|
|
||||||
<< table.render ()
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Complain about configuration variables that are not recognized.
|
// Complain about configuration variables that are not recognized.
|
||||||
// These are the regular configuration variables.
|
// These are the regular configuration variables.
|
||||||
// Note that there is a leading and trailing space, to make searching easier.
|
// Note that there is a leading and trailing space, to make searching easier.
|
||||||
|
@ -753,14 +718,59 @@ int handleConfig (std::string &outs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a table for output.
|
||||||
|
Table table;
|
||||||
|
table.setTableWidth (width);
|
||||||
|
table.setDateFormat (context.config.get ("dateformat"));
|
||||||
|
table.addColumn ("Config variable");
|
||||||
|
table.addColumn ("Value");
|
||||||
|
|
||||||
|
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
||||||
|
{
|
||||||
|
table.setColumnUnderline (0);
|
||||||
|
table.setColumnUnderline (1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
table.setTableDashedUnderline ();
|
||||||
|
|
||||||
|
table.setColumnWidth (0, Table::minimum);
|
||||||
|
table.setColumnWidth (1, Table::flexible);
|
||||||
|
table.setColumnJustification (0, Table::left);
|
||||||
|
table.setColumnJustification (1, Table::left);
|
||||||
|
table.sortOn (0, Table::ascendingCharacter);
|
||||||
|
|
||||||
|
Color error ("bold white on red");
|
||||||
|
foreach (i, all)
|
||||||
|
{
|
||||||
|
std::string value = context.config.get (*i);
|
||||||
|
int row = table.addRow ();
|
||||||
|
table.addCell (row, 0, *i);
|
||||||
|
table.addCell (row, 1, value);
|
||||||
|
|
||||||
|
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
||||||
|
if (std::find (unrecognized.begin (), unrecognized.end (), *i) != unrecognized.end ())
|
||||||
|
table.setRowColor (row, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Color bold ("bold");
|
||||||
|
|
||||||
|
out << std::endl
|
||||||
|
<< table.render ()
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
// Display the unrecognized variables.
|
||||||
if (unrecognized.size ())
|
if (unrecognized.size ())
|
||||||
{
|
{
|
||||||
out << "Your .taskrc file contains these unrecognized variables:"
|
out << "Your .taskrc file contains these unrecognized variables:"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
foreach (i, unrecognized)
|
foreach (i, unrecognized)
|
||||||
out << " " << *i << std::endl;
|
out << " " << *i << std::endl;
|
||||||
|
|
||||||
|
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
||||||
|
out << std::endl
|
||||||
|
<< " These are highlighted in " << error.colorize ("color") << " above.";
|
||||||
|
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue