- Fixed bug which failed to propagate rc overrides from the command
  line to the default command (thanks to Zach Frazier).
This commit is contained in:
Paul Beckingham 2009-09-06 16:27:28 -04:00
parent bdaa0f89d9
commit 53609b2837
5 changed files with 12 additions and 6 deletions

View file

@ -38,4 +38,4 @@ Thanks to the following, who submitted detailed bug reports and excellent sugges
Mike Adonay Mike Adonay
Thomas@BIC Thomas@BIC
Ian Mortimer Ian Mortimer
Zach Frazier

View file

@ -10,7 +10,9 @@
+ Fixed bug #289 which imported task from todo.sh without valid uuids + Fixed bug #289 which imported task from todo.sh without valid uuids
(thanks to Ben Jackson). (thanks to Ben Jackson).
+ Fixed bug #291 which generated a false warning about an unrecognized + Fixed bug #291 which generated a false warning about an unrecognized
variable when enabling default.projects in .taskrc (thanks to Thomas@BIC) variable when enabling default.projects in .taskrc (thanks to Thomas@BIC).
+ Fixed bug #288 which failed to propagate rc file overrides on the command
line to the default command (thanks to Zach Frazier).
------ old releases ------------------------------ ------ old releases ------------------------------

View file

@ -49,6 +49,7 @@ Context::Context ()
, tdb () , tdb ()
, stringtable () , stringtable ()
, program ("") , program ("")
, overrides ("")
, cmd () , cmd ()
, inShadow (false) , inShadow (false)
{ {
@ -438,6 +439,7 @@ void Context::loadCorrectConfigFile ()
n.getUntilEOS (value)) n.getUntilEOS (value))
{ {
config.set (name, value); config.set (name, value);
overrides += " " + *arg;
footnote (std::string ("Configuration override ") + // TODO i18n footnote (std::string ("Configuration override ") + // TODO i18n
arg->substr (3, std::string::npos)); arg->substr (3, std::string::npos));
} }
@ -654,12 +656,13 @@ void Context::parse (
// then invoke the default command. // then invoke the default command.
if (parseCmd.command == "" && parseArgs.size () == 0) if (parseCmd.command == "" && parseArgs.size () == 0)
{ {
std::string defaultCommand = config.get ("default.command"); // Apply overrides, if any.
std::string defaultCommand = config.get ("default.command") + overrides;
if (defaultCommand != "") if (defaultCommand != "")
{ {
// Stuff the command line. // Stuff the command line.
parseArgs.clear (); args.clear ();
split (parseArgs, defaultCommand, ' '); split (args, defaultCommand, ' ');
header ("[task " + defaultCommand + "]"); header ("[task " + defaultCommand + "]");
// Reinitialize the context and recurse. // Reinitialize the context and recurse.

View file

@ -83,6 +83,7 @@ public:
StringTable stringtable; StringTable stringtable;
std::string program; std::string program;
std::vector <std::string> args; std::vector <std::string> args;
std::string overrides;
Cmd cmd; Cmd cmd;
std::map <std::string, std::string> aliases; std::map <std::string, std::string> aliases;
std::vector <std::string> tagAdditions; std::vector <std::string> tagAdditions;

View file

@ -40,7 +40,7 @@ if (open my $fh, '>', 'basic.rc')
# Test the usage command. # Test the usage command.
my $output = qx{../task rc:basic.rc}; my $output = qx{../task rc:basic.rc};
like ($output, qr/You must specify a command, or a task ID to modify/, 'missing command and ID'); like ($output, qr/You must specify a command, or a task ID to modify/m, 'missing command and ID');
# Test the version command. # Test the version command.
$output = qx{../task rc:basic.rc version}; $output = qx{../task rc:basic.rc version};