mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Legacy Checking
- The 'show' command now mentions use of any deprecated configuration variables.
This commit is contained in:
parent
dc3470a9a8
commit
0aa953dc4e
4 changed files with 46 additions and 8 deletions
|
@ -284,6 +284,16 @@ int CmdShow::execute (std::string& output)
|
|||
<< (view.rows () == 0 ? STRING_CMD_SHOW_NONE : "")
|
||||
<< (view.rows () == 0 ? "\n\n" : "\n");
|
||||
|
||||
if (default_values.size ())
|
||||
{
|
||||
out << STRING_CMD_SHOW_DIFFER;
|
||||
|
||||
if (context.color ())
|
||||
out << " "
|
||||
<< format (STRING_CMD_SHOW_DIFFER_COLOR, warning.colorize ("color"))
|
||||
<< "\n\n";
|
||||
}
|
||||
|
||||
// Display the unrecognized variables.
|
||||
if (unrecognized.size ())
|
||||
{
|
||||
|
@ -298,14 +308,7 @@ int CmdShow::execute (std::string& output)
|
|||
out << "\n\n";
|
||||
}
|
||||
|
||||
if (default_values.size ())
|
||||
{
|
||||
out << STRING_CMD_SHOW_DIFFER;
|
||||
|
||||
if (context.color ())
|
||||
out << " " << format (STRING_CMD_SHOW_DIFFER_COLOR, warning.colorize ("color"));
|
||||
}
|
||||
|
||||
out << legacyCheckForDeprecatedVariables ();
|
||||
out << legacyCheckForDeprecatedColor ();
|
||||
out << legacyCheckForDeprecatedColumns ();
|
||||
|
||||
|
|
|
@ -495,6 +495,7 @@
|
|||
#define STRING_CONFIG_BAD_WRITE "Could not write to '{1}'."
|
||||
#define STRING_CONFIG_DEPRECATED_US "Your .taskrc file contains color settings that use deprecated underscores. Please check:"
|
||||
#define STRING_CONFIG_DEPRECATED_COL "Your .taskrc file contains reports with deprecated columns. Please check for entry_time, start_time or end_time in:"
|
||||
#define STRING_CONFIG_DEPRECATED_VAR "Your .taskrc file contains variables that are deprecated:"
|
||||
|
||||
// Context
|
||||
#define STRING_CONTEXT_CREATE_RC "A configuration file could not be found in {1}\n\nWould you like a sample {2} created, so taskwarrior can proceed?"
|
||||
|
|
|
@ -134,6 +134,39 @@ std::string legacyCheckForDeprecatedColor ()
|
|||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string legacyCheckForDeprecatedVariables ()
|
||||
{
|
||||
std::vector <std::string> deprecated;
|
||||
std::map <std::string, std::string>::const_iterator it;
|
||||
for (it = context.config.begin (); it != context.config.end (); ++it)
|
||||
{
|
||||
// report.*.limit
|
||||
if (it->first.substr (0, 7) == "report." &&
|
||||
it->first.substr (it->first.length () - 6) == ".limit")
|
||||
deprecated.push_back (it->first);
|
||||
|
||||
if (it->first == "echo.command" ||
|
||||
it->first == "edit.verbose")
|
||||
deprecated.push_back (it->first);
|
||||
}
|
||||
|
||||
std::stringstream out;
|
||||
if (deprecated.size ())
|
||||
{
|
||||
out << STRING_CONFIG_DEPRECATED_VAR
|
||||
<< "\n";
|
||||
|
||||
std::vector <std::string>::iterator it2;
|
||||
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
|
||||
out << " " << *it2 << "\n";
|
||||
|
||||
out << "\n";
|
||||
}
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string legacyCheckForDeprecatedColumns ()
|
||||
{
|
||||
|
|
|
@ -86,6 +86,7 @@ void legacyAttributeCheck (const std::string&);
|
|||
void legacyColumnMap (std::string&);
|
||||
void legacySortColumnMap (std::string&);
|
||||
std::string legacyCheckForDeprecatedColor ();
|
||||
std::string legacyCheckForDeprecatedVariables ();
|
||||
std::string legacyCheckForDeprecatedColumns ();
|
||||
|
||||
// list template
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue