Enhancement - rc.name:value

- Supports 'rc.name:value' for a command line override to .taskrc data
  (thanks to Federico Hernandez).
This commit is contained in:
Paul Beckingham 2009-06-06 16:09:11 -04:00
parent 37dd592110
commit 82f94a6999
3 changed files with 16 additions and 11 deletions

View file

@ -20,6 +20,8 @@
Chris Pride). Chris Pride).
+ Custom reports now support a more compact form of the "age" column, + Custom reports now support a more compact form of the "age" column,
called "age_compact" (thanks to T. Charles Yun). called "age_compact" (thanks to T. Charles Yun).
+ Supports 'rc.name:value' for a command line override to .taskrc data
(thanks to Federico Hernandez).
+ Removed obsolete DEVELOPERS file. The online support forums at + Removed obsolete DEVELOPERS file. The online support forums at
http://taskwarrior.org will provide better information. http://taskwarrior.org will provide better information.
+ Replaced website references with http://taskwarrior.org. + Replaced website references with http://taskwarrior.org.

View file

@ -201,13 +201,11 @@ void Context::loadCorrectConfigFile ()
if (arg->substr (0, 3) == "rc:") if (arg->substr (0, 3) == "rc:")
{ {
std::string file = arg->substr (3, std::string::npos); std::string file = arg->substr (3, std::string::npos);
if (! access (file.c_str (), F_OK)) if (access (file.c_str (), F_OK))
{
config.load (file);
return;
}
else
throw std::string ("Could not read configuration file '") + file + "'"; throw std::string ("Could not read configuration file '") + file + "'";
messages.push_back (std::string ("Using alternate .taskrc file ") + file); // TODO i18n
config.load (file);
} }
} }
@ -221,8 +219,6 @@ void Context::loadCorrectConfigFile ()
config.createDefault (file); config.createDefault (file);
// Apply overrides of type: "rc.name:value" // Apply overrides of type: "rc.name:value"
/*
// TODO Maybe this should happen after the parse?
foreach (arg, args) foreach (arg, args)
{ {
if (arg->substr (0, 3) == "rc.") if (arg->substr (0, 3) == "rc.")
@ -237,10 +233,11 @@ void Context::loadCorrectConfigFile ()
n.getUntilEOS (value)) n.getUntilEOS (value))
{ {
config.set (name, value); config.set (name, value);
messages.push_back (std::string ("Configuration override ") + // TODO i18n
arg->substr (3, std::string::npos));
} }
} }
} }
*/
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -258,7 +255,8 @@ void Context::parse ()
{ {
// Ignore any argument that is "rc:...", because that is the command line // Ignore any argument that is "rc:...", because that is the command line
// specified rc file. // specified rc file.
if (arg->substr (0, 3) != "rc:") if (arg->substr (0, 3) != "rc:" ||
arg->substr (0, 3) != "rc.")
{ {
if (!terminated) if (!terminated)
{ {

View file

@ -265,7 +265,12 @@ static std::string longUsage ()
<< " until: Recurrence end date" << "\n" << " until: Recurrence end date" << "\n"
<< " fg: Foreground color" << "\n" << " fg: Foreground color" << "\n"
<< " bg: Background color" << "\n" << " bg: Background color" << "\n"
<< " rc: Alternate .taskrc file" << "\n" << "\n"
<< "The default .taskrc file can be overridden with:" << "\n"
<< " task rc:<alternate file> ..." << "\n"
<< "\n"
<< "The values in .taskrc (or alternate) can be overridden with:" << "\n"
<< " task ... rc.<name>:<value>" << "\n"
<< "\n" << "\n"
<< "Any command or attribute name may be abbreviated if still unique:" << "\n" << "Any command or attribute name may be abbreviated if still unique:" << "\n"
<< " task list project:Home" << "\n" << " task list project:Home" << "\n"