Bug Fix - Problem with #320

- The new auto-info command interfered with task modification.  Should
  have run all the unit tests before committing that change.
- Added auto-info command to the help text.
This commit is contained in:
Paul Beckingham 2010-05-30 15:03:58 -04:00
parent 67ffd07312
commit 336a4dea01
2 changed files with 26 additions and 5 deletions

View file

@ -526,6 +526,7 @@ void Context::parse (
bool terminated = false;
bool foundSequence = false;
bool foundSomethingAfterSequence = false;
bool foundNonSequence = false;
foreach (arg, parseArgs)
{
@ -540,7 +541,7 @@ void Context::parse (
// Sequence
// Note: "add" doesn't require an ID
else if (parseCmd.command != "add" &&
else if (parseCmd.command != "add" &&
! foundSomethingAfterSequence &&
parseSequence.valid (*arg))
{
@ -558,6 +559,8 @@ void Context::parse (
if (foundSequence)
foundSomethingAfterSequence = true;
foundNonSequence = true;
if (arg->find (',') != std::string::npos)
throw stringtable.get (TAGS_NO_COMMA,
"Tags are not permitted to contain commas.");
@ -575,6 +578,8 @@ void Context::parse (
if (foundSequence)
foundSomethingAfterSequence = true;
foundNonSequence = true;
if (arg->find (',') != std::string::npos)
throw stringtable.get (TAGS_NO_COMMA,
"Tags are not permitted to contain commas.");
@ -589,6 +594,8 @@ void Context::parse (
if (foundSequence)
foundSomethingAfterSequence = true;
foundNonSequence = true;
attribute.parse (*arg);
// There has to be a better way. And it starts with a fresh coffee.
@ -618,6 +625,8 @@ void Context::parse (
if (foundSequence)
foundSomethingAfterSequence = true;
foundNonSequence = true;
if (descCandidate.length ())
descCandidate += " ";
descCandidate += *arg;
@ -630,6 +639,8 @@ void Context::parse (
if (foundSequence)
foundSomethingAfterSequence = true;
foundNonSequence = true;
debug ("parse subst '" + *arg + "'");
parseSubst.parse (*arg);
}
@ -643,6 +654,8 @@ void Context::parse (
if (foundSequence)
foundSomethingAfterSequence = true;
foundNonSequence = true;
}
// Anything else is just considered description.
@ -651,6 +664,8 @@ void Context::parse (
if (foundSequence)
foundSomethingAfterSequence = true;
foundNonSequence = true;
if (descCandidate.length ())
descCandidate += " ";
descCandidate += *arg;
@ -675,6 +690,8 @@ void Context::parse (
debug ("parse description '" + descCandidate + "'");
parseTask.set ("description", descCandidate);
foundNonSequence = true;
// Now convert the description to a filter on each word, if necessary.
if (parseCmd.isReadOnlyCommand ())
{
@ -730,10 +747,10 @@ void Context::parse (
"You must specify a command, or a task ID to modify");
}
// If the command "task 123" is entered, then the actual command is assumed
// to be "info".
else if (parseTask.id != 0 ||
parseSequence.size () != 0)
// If the command "task 123" is entered, but with no modifier arguments,
// then the actual command is assumed to be "info".
else if (!foundNonSequence &&
(parseTask.id != 0 || parseSequence.size () != 0))
{
std::cout << "No command - assuming 'info'." << std::endl;
parseCmd.command = "info";

View file

@ -100,6 +100,10 @@ int shortUsage (std::string &outs)
"substitutions for all matching text, not just the "
"first occurrence.");
row = table.addRow ();
table.addCell (row, 1, "task ID");
table.addCell (row, 2, "Specifying an ID without a command invokes the 'info' command.");
row = table.addRow ();
table.addCell (row, 1, "task edit ID");
table.addCell (row, 2, "Launches an editor to let you modify all aspects of a task directly, therefore it is to be used carefully.");