- 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 "usage" command, and support for "command.logging" configuration
variable.
+ "task stop" can now remove the start time from a started task.
------ old releases ------------------------------

View file

@ -157,6 +157,11 @@ ID Project Pri Due Active Age Description
"task start ..." command was run, as shown above.
</p>
<strong>% task stop &lt;id&gt;</strong>
<p>
Marks a task as inactive, by removing the start time.
</p>
<strong>% task overdue</strong>
<p>
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 "usage" command, and support for "command.logging" configuration
variable.
<li>"task stop" can remove the start time from a started task.
</ul>
<p>

View file

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

View file

@ -441,6 +441,36 @@ void handleStart (TDB& tdb, T& task, Config& conf)
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)
{

View file

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

View file

@ -125,7 +125,11 @@ static void shortUsage (Config& conf)
row = table.addRow ();
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 ();
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"));
tdb.dataDirectory (dataLocation);
// Log commands, if desired.
if (conf.get ("command.logging") == "on")
tdb.logCommand (argc, argv);
// Set up TDB callback.
std::string shadowFile = expandPath (conf.get ("shadow.file"));
if (shadowFile != "")
@ -766,6 +766,7 @@ void runTaskCommand (
else if (command == "completed") handleCompleted (tdb, task, conf);
else if (command == "delete") handleDelete (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 == "undo") handleUndo (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 == "newest") handleReportNewest (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 == "help") longUsage (conf);
else shortUsage (conf);

View file

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