Feature - Config validation
- The 'version' command now complains about use of deprecated color names and duplicate entries. - Unit tests verify duplicate detection. - Unit tests verify deprecated color detection. - Most validation code moved from command.cpp to Config.cpp.
This commit is contained in:
@@ -551,31 +551,8 @@ int handleVersion (std::string &outs)
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
// Complain about colors that still use underscores.
|
||||
int countDeprecatedColors = 0;
|
||||
std::vector <std::string> deprecatedColors;
|
||||
foreach (i, all)
|
||||
{
|
||||
if (i->find ("color.") != std::string::npos)
|
||||
{
|
||||
std::string value = context.config.get (*i);
|
||||
if (value.find ("_") != std::string::npos)
|
||||
{
|
||||
++countDeprecatedColors;
|
||||
deprecatedColors.push_back (*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (countDeprecatedColors)
|
||||
{
|
||||
out << "Your .taskrc file contains color settings that use deprecated "
|
||||
<< "underscores. Please check:"
|
||||
<< std::endl;
|
||||
|
||||
foreach (i, deprecatedColors)
|
||||
out << " " << *i << "=" << context.config.get (*i) << std::endl;
|
||||
}
|
||||
out << context.config.checkForDeprecatedColor ();
|
||||
out << context.config.checkForDuplicates ();
|
||||
|
||||
// Verify installation. This is mentioned in the documentation as the way to
|
||||
// ensure everything is properly installed.
|
||||
|
||||
Reference in New Issue
Block a user