Enhancement - rc.name=value

- Task now supports both "rc.name:value" and "rc.name=value", not because
  this is generally a good idea, but because it is a very common mistake
  that we are all making, and shouldn't the software be forgiving in an
  unambiguous case like this?
This commit is contained in:
Paul Beckingham 2009-10-10 11:15:32 -04:00
parent d7bded0d73
commit 99641e7b0b

View file

@ -384,7 +384,8 @@ void Context::loadCorrectConfigFile ()
{ {
if (*arg == "--") if (*arg == "--")
break; break;
else if (arg->substr (0, 17) == "rc.data.location:") else if (arg->substr (0, 17) == "rc.data.location:" ||
arg->substr (0, 17) == "rc.data.location=")
{ {
data = arg->substr (17, std::string::npos); data = arg->substr (17, std::string::npos);
header ("Using alternate data.location " + data); // TODO i18n header ("Using alternate data.location " + data); // TODO i18n
@ -416,7 +417,7 @@ void Context::loadCorrectConfigFile ()
config.setDefaults (); // Add in the custom reports. config.setDefaults (); // Add in the custom reports.
config.load (rc); // Load new file. config.load (rc); // Load new file.
// Apply overrides of type: "rc.name:value" // Apply overrides of type: "rc.name:value", or "rc.name=value".
std::vector <std::string> filtered; std::vector <std::string> filtered;
bool foundTerminator = false; bool foundTerminator = false;
foreach (arg, args) foreach (arg, args)
@ -432,10 +433,10 @@ void Context::loadCorrectConfigFile ()
std::string name; std::string name;
std::string value; std::string value;
Nibbler n (*arg); Nibbler n (*arg);
if (n.getUntil ('.', name) && if (n.getUntil ('.', name) &&
n.skip ('.') && n.skip ('.') &&
n.getUntil (':', name) && n.getUntilOneOf (":=", name) &&
n.skip (':') && n.skipN (1) &&
n.getUntilEOS (value)) n.getUntilEOS (value))
{ {
config.set (name, value); config.set (name, value);