mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 17:07:19 +02:00
Enhancement
- Implemented tri-state confirmation for done command.
This commit is contained in:
parent
8d76eaca88
commit
3dcda73e0c
1 changed files with 28 additions and 12 deletions
|
@ -679,13 +679,21 @@ std::string handleDone ()
|
||||||
std::vector <Task> all = tasks;
|
std::vector <Task> all = tasks;
|
||||||
context.filter.applySequence (tasks, context.sequence);
|
context.filter.applySequence (tasks, context.sequence);
|
||||||
|
|
||||||
|
Permission permission;
|
||||||
|
if (context.sequence.size () > (size_t) context.config.get ("bulk", 2))
|
||||||
|
permission.bigSequence ();
|
||||||
|
|
||||||
bool nagged = false;
|
bool nagged = false;
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if (task->getStatus () == Task::pending)
|
if (task->getStatus () == Task::pending)
|
||||||
{
|
{
|
||||||
// Apply deltas.
|
Task before (*task);
|
||||||
deltaDescription (*task);
|
|
||||||
|
// Apply other deltas.
|
||||||
|
if (deltaDescription (*task))
|
||||||
|
permission.bigChange ();
|
||||||
|
|
||||||
deltaTags (*task);
|
deltaTags (*task);
|
||||||
deltaAttributes (*task);
|
deltaAttributes (*task);
|
||||||
deltaSubstitutions (*task);
|
deltaSubstitutions (*task);
|
||||||
|
@ -697,6 +705,12 @@ std::string handleDone ()
|
||||||
|
|
||||||
// Change status.
|
// Change status.
|
||||||
task->setStatus (Task::completed);
|
task->setStatus (Task::completed);
|
||||||
|
|
||||||
|
if (taskDiff (before, *task))
|
||||||
|
{
|
||||||
|
std::string question = taskDifferences (before, *task) + "Are you sure?";
|
||||||
|
if (permission.confirmed (question))
|
||||||
|
{
|
||||||
context.tdb.update (*task);
|
context.tdb.update (*task);
|
||||||
|
|
||||||
if (context.config.get ("echo.command", true))
|
if (context.config.get ("echo.command", true))
|
||||||
|
@ -707,11 +721,13 @@ std::string handleDone ()
|
||||||
<< "'"
|
<< "'"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateRecurrenceMask (all, *task);
|
updateRecurrenceMask (all, *task);
|
||||||
if (!nagged)
|
if (!nagged)
|
||||||
nagged = nag (*task);
|
nagged = nag (*task);
|
||||||
|
|
||||||
++count;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out << "Task "
|
out << "Task "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue