diff --git a/ChangeLog b/ChangeLog index c2b641218..52f729398 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 ------------------------------ diff --git a/html/advanced.html b/html/advanced.html index 30fc4a436..1aeb75361 100644 --- a/html/advanced.html +++ b/html/advanced.html @@ -157,6 +157,11 @@ ID Project Pri Due Active Age Description "task start ..." command was run, as shown above.

+ % task stop <id> +

+ Marks a task as inactive, by removing the start time. +

+ % task overdue

Simply lists all the task that have a due date that is past, in diff --git a/html/task.html b/html/task.html index b4ba90991..3118b1ea4 100644 --- a/html/task.html +++ b/html/task.html @@ -99,6 +99,7 @@

  • Removed deprecated TUTORIAL file.
  • Removed "usage" command, and support for "command.logging" configuration variable. +
  • "task stop" can remove the start time from a started task.

    diff --git a/html/usage.html b/html/usage.html index 92b7b1d88..7c42de3a5 100644 --- a/html/usage.html +++ b/html/usage.html @@ -44,6 +44,7 @@ task undelete ID task info ID task start ID + task stop ID task done ID task undo ID task projects diff --git a/src/command.cpp b/src/command.cpp index 6d0b70508..b444b9515 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -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 all; + tdb.pendingT (all); + + std::vector ::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) { diff --git a/src/parse.cpp b/src/parse.cpp index bf835ac55..1e88ef534 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -138,6 +138,7 @@ static const char* commands[] = "projects", "start", "stats", + "stop", "summary", "tags", "undelete", diff --git a/src/task.cpp b/src/task.cpp index 88711d8cf..1a54418f9 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -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); diff --git a/src/task.h b/src/task.h index bc15fbfc3..1f550bd34 100644 --- a/src/task.h +++ b/src/task.h @@ -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&);