mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement - en passant "done"
- When marking task(s) as done, it is now possible to modify them at the same time.
This commit is contained in:
parent
b23bad9a5b
commit
5cf33105a3
3 changed files with 45 additions and 15 deletions
|
@ -280,6 +280,7 @@ bool TDB::completeT (const T& t)
|
|||
for (it = all.begin (); it != all.end (); ++it)
|
||||
if (task.getId () == it->getId ())
|
||||
{
|
||||
*it = t;
|
||||
it->setStatus (T::completed);
|
||||
|
||||
char endTime[16];
|
||||
|
|
|
@ -570,31 +570,56 @@ std::string handleStop (TDB& tdb, T& task, Config& conf)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string handleDone (TDB& tdb, T& task, Config& conf)
|
||||
{
|
||||
int count = 0;
|
||||
std::stringstream out;
|
||||
|
||||
std::vector <T> all;
|
||||
tdb.allPendingT (all);
|
||||
|
||||
std::vector <T> filtered = all;
|
||||
filterSequence (filtered, task);
|
||||
|
||||
foreach (t, filtered)
|
||||
foreach (seq, filtered)
|
||||
{
|
||||
t->setStatus (T::completed);
|
||||
if (!tdb.completeT (*t))
|
||||
if (seq->getStatus () == T::pending)
|
||||
{
|
||||
// Apply deltas.
|
||||
deltaDescription (*seq, task);
|
||||
deltaTags (*seq, task);
|
||||
deltaAttributes (*seq, task);
|
||||
deltaSubstitutions (*seq, task);
|
||||
|
||||
seq->setStatus (T::completed);
|
||||
if (!tdb.completeT (*seq))
|
||||
throw std::string ("Could not mark task as completed.");
|
||||
|
||||
// Now update mask in parent.
|
||||
if (conf.get ("echo.command", true))
|
||||
out << "Completed "
|
||||
<< t->getId ()
|
||||
<< seq->getId ()
|
||||
<< " '"
|
||||
<< t->getDescription ()
|
||||
<< seq->getDescription ()
|
||||
<< "'"
|
||||
<< std::endl;
|
||||
|
||||
updateRecurrenceMask (tdb, all, *t);
|
||||
nag (tdb, task, conf);
|
||||
updateRecurrenceMask (tdb, all, *seq);
|
||||
nag (tdb, *seq, conf);
|
||||
|
||||
++count;
|
||||
}
|
||||
else
|
||||
out << "Task "
|
||||
<< seq->getId ()
|
||||
<< " '"
|
||||
<< seq->getDescription ()
|
||||
<< "' is not pending"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
if (conf.get ("echo.command", true))
|
||||
out << "Marked "
|
||||
<< count
|
||||
<< " task"
|
||||
<< (count == 1 ? "" : "s")
|
||||
<< " as done"
|
||||
<< std::endl;
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
|
|
@ -220,6 +220,10 @@ static std::string shortUsage (Config& conf)
|
|||
<< "full tutorial. New releases containing fixes and enhancements are "
|
||||
<< "made frequently."
|
||||
<< std::endl
|
||||
<< std::endl
|
||||
<< "Join in the discussion of task, present and future, at "
|
||||
<< "http://groups.google.com/group/taskprogram"
|
||||
<< std::endl
|
||||
<< std::endl;
|
||||
|
||||
return out.str ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue