Enhancement - config command

- Added validation of rc.annotations and rc.default.priority to the config
  command.
This commit is contained in:
Paul Beckingham 2010-01-23 00:12:34 -05:00
parent 4025488cf8
commit 545013e839
3 changed files with 23 additions and 2 deletions

2
NEWS
View file

@ -28,7 +28,7 @@ Task has been built and tested on the following configurations:
* Solaris 10 and 8
* OpenBSD 4.5
* FreeBSD
* Cygwin 1.5
* Cygwin 1.7 and 1.5
* Haiku R1/alpha1
While Task has undergone testing, bugs are sure to remain. If you encounter a

View file

@ -59,7 +59,7 @@ std::string Config::defaults =
"# Miscellaneous\n"
"confirmation=yes # Confirmation on delete, big changes\n"
"echo.command=yes # Details on command just run\n"
"annotations=full # Level of verbosity for annotations in reports\n"
"annotations=full # Level of verbosity for annotations: full, sparse or none\n"
"next=2 # How many tasks per project in next report\n"
"bulk=2 # > 2 tasks considered 'a lot', for confirmation\n"
"nag=You have higher priority tasks. # Nag message to keep you honest\n" // TODO

View file

@ -708,6 +708,27 @@ int handleConfig (std::string &outs)
// TODO Check for referenced but missing theme files.
// TODO Check for referenced but missing string files.
// Check for bad values in rc.annotations.
std::string annotations = context.config.get ("annotations");
if (annotations != "full" &&
annotations != "sparse" &&
annotations != "none")
out << "Configuration error: annotations contains an unrecognized value '"
<< annotations
<< "'."
<< std::endl;
// Check for bad values in rc.default.priority.
std::string defaultPriority = context.config.get ("default.priority");
if (defaultPriority != "H" &&
defaultPriority != "M" &&
defaultPriority != "L" &&
defaultPriority != "")
out << "Configuration error: default.priority contains an unrecognized value '"
<< defaultPriority
<< "'."
<< std::endl;
// Verify installation. This is mentioned in the documentation as the way to
// ensure everything is properly installed.