- Added support for "task stop <id>" command, that removes the start time from a task.

- Updated documentation accordingly.
This commit is contained in:
Paul Beckingham 2008-10-19 11:47:03 -04:00
parent 47c02965e9
commit 0987171280
8 changed files with 46 additions and 6 deletions

View file

@ -5,6 +5,7 @@
+ Removed deprecated TUTORIAL file. + Removed deprecated TUTORIAL file.
+ Removed "usage" command, and support for "command.logging" configuration + Removed "usage" command, and support for "command.logging" configuration
variable. variable.
+ "task stop" can now remove the start time from a started task.
------ old releases ------------------------------ ------ old releases ------------------------------

View file

@ -157,6 +157,11 @@ ID Project Pri Due Active Age Description
"task start ..." command was run, as shown above. "task start ..." command was run, as shown above.
</p> </p>
<strong>% task stop &lt;id&gt;</strong>
<p>
Marks a task as inactive, by removing the start time.
</p>
<strong>% task overdue</strong> <strong>% task overdue</strong>
<p> <p>
Simply lists all the task that have a due date that is past, in Simply lists all the task that have a due date that is past, in

View file

@ -99,6 +99,7 @@
<li>Removed deprecated TUTORIAL file. <li>Removed deprecated TUTORIAL file.
<li>Removed "usage" command, and support for "command.logging" configuration <li>Removed "usage" command, and support for "command.logging" configuration
variable. variable.
<li>"task stop" can remove the start time from a started task.
</ul> </ul>
<p> <p>

View file

@ -44,6 +44,7 @@
task undelete ID task undelete ID
task info ID task info ID
task start ID task start ID
task stop ID
task done ID task done ID
task undo ID task undo ID
task projects task projects

View file

@ -441,6 +441,36 @@ void handleStart (TDB& tdb, T& task, Config& conf)
throw std::string ("Task not found."); throw std::string ("Task not found.");
} }
////////////////////////////////////////////////////////////////////////////////
void handleStop (TDB& tdb, T& task, Config& conf)
{
std::vector <T> all;
tdb.pendingT (all);
std::vector <T>::iterator it;
for (it = all.begin (); it != all.end (); ++it)
{
if (it->getId () == task.getId ())
{
T original (*it);
if (original.getAttribute ("start") != "")
{
original.removeAttribute ("start");
original.setId (task.getId ());
tdb.modifyT (original);
nag (tdb, task, conf);
return;
}
else
std::cout << "Task " << task.getId () << " not started." << std::endl;
}
}
throw std::string ("Task not found.");
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void handleDone (TDB& tdb, T& task, Config& conf) void handleDone (TDB& tdb, T& task, Config& conf)
{ {

View file

@ -138,6 +138,7 @@ static const char* commands[] =
"projects", "projects",
"start", "start",
"stats", "stats",
"stop",
"summary", "summary",
"tags", "tags",
"undelete", "undelete",

View file

@ -125,7 +125,11 @@ static void shortUsage (Config& conf)
row = table.addRow (); row = table.addRow ();
table.addCell (row, 1, "task start ID"); table.addCell (row, 1, "task start ID");
table.addCell (row, 2, "Marks specified task as started, starts the clock ticking"); table.addCell (row, 2, "Marks specified task as started");
row = table.addRow ();
table.addCell (row, 1, "task stop ID");
table.addCell (row, 2, "Removes the 'start' time from a task");
row = table.addRow (); row = table.addRow ();
table.addCell (row, 1, "task done ID"); table.addCell (row, 1, "task done ID");
@ -300,10 +304,6 @@ int main (int argc, char** argv)
std::string dataLocation = expandPath (conf.get ("data.location")); std::string dataLocation = expandPath (conf.get ("data.location"));
tdb.dataDirectory (dataLocation); tdb.dataDirectory (dataLocation);
// Log commands, if desired.
if (conf.get ("command.logging") == "on")
tdb.logCommand (argc, argv);
// Set up TDB callback. // Set up TDB callback.
std::string shadowFile = expandPath (conf.get ("shadow.file")); std::string shadowFile = expandPath (conf.get ("shadow.file"));
if (shadowFile != "") if (shadowFile != "")
@ -766,6 +766,7 @@ void runTaskCommand (
else if (command == "completed") handleCompleted (tdb, task, conf); else if (command == "completed") handleCompleted (tdb, task, conf);
else if (command == "delete") handleDelete (tdb, task, conf); else if (command == "delete") handleDelete (tdb, task, conf);
else if (command == "start") handleStart (tdb, task, conf); else if (command == "start") handleStart (tdb, task, conf);
else if (command == "stop") handleStop (tdb, task, conf);
else if (command == "done") handleDone (tdb, task, conf); else if (command == "done") handleDone (tdb, task, conf);
else if (command == "undo") handleUndo (tdb, task, conf); else if (command == "undo") handleUndo (tdb, task, conf);
else if (command == "export") handleExport (tdb, task, conf); else if (command == "export") handleExport (tdb, task, conf);
@ -780,7 +781,6 @@ void runTaskCommand (
else if (command == "oldest") handleReportOldest (tdb, task, conf); else if (command == "oldest") handleReportOldest (tdb, task, conf);
else if (command == "newest") handleReportNewest (tdb, task, conf); else if (command == "newest") handleReportNewest (tdb, task, conf);
else if (command == "stats") handleReportStats (tdb, task, conf); else if (command == "stats") handleReportStats (tdb, task, conf);
else if (command == "usage") handleReportUsage (tdb, task, conf);
else if (command == "" && task.getId ()) handleModify (tdb, task, conf); else if (command == "" && task.getId ()) handleModify (tdb, task, conf);
else if (command == "help") longUsage (conf); else if (command == "help") longUsage (conf);
else shortUsage (conf); else shortUsage (conf);

View file

@ -79,6 +79,7 @@ void handleVersion (Config&);
void handleExport (TDB&, T&, Config&); void handleExport (TDB&, T&, Config&);
void handleDelete (TDB&, T&, Config&); void handleDelete (TDB&, T&, Config&);
void handleStart (TDB&, T&, Config&); void handleStart (TDB&, T&, Config&);
void handleStop (TDB&, T&, Config&);
void handleDone (TDB&, T&, Config&); void handleDone (TDB&, T&, Config&);
void handleUndo (TDB&, T&, Config&); void handleUndo (TDB&, T&, Config&);
void handleModify (TDB&, T&, Config&); void handleModify (TDB&, T&, Config&);