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:
Paul Beckingham
2009-12-08 22:56:01 -05:00
parent b032a00283
commit 42c1b30c31
6 changed files with 206 additions and 25 deletions

View File

@@ -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.