From 336a4dea01c2d410c10953ee4e1c21df48c23bd0 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 30 May 2010 15:03:58 -0400 Subject: [PATCH] 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. --- src/Context.cpp | 27 ++++++++++++++++++++++----- src/report.cpp | 4 ++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 2bf963d39..c53f8b554 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -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"; diff --git a/src/report.cpp b/src/report.cpp index 002c99e38..a04dcb438 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -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.");