mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement
- Implemented tri-state confirmation in the annotate command.
This commit is contained in:
parent
a2cc75d2c7
commit
8d76eaca88
1 changed files with 21 additions and 8 deletions
|
@ -1172,18 +1172,31 @@ std::string handleAnnotate ()
|
||||||
// Filter sequence.
|
// Filter sequence.
|
||||||
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 ();
|
||||||
|
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
|
Task before (*task);
|
||||||
task->addAnnotation (context.task.get ("description"));
|
task->addAnnotation (context.task.get ("description"));
|
||||||
context.tdb.update (*task);
|
|
||||||
|
|
||||||
if (context.config.get ("echo.command", true))
|
if (taskDiff (before, *task))
|
||||||
out << "Annotated "
|
{
|
||||||
<< task->id
|
std::string question = taskDifferences (before, *task) + "Are you sure?";
|
||||||
<< " with '"
|
if (permission.confirmed (question))
|
||||||
<< task->get ("description")
|
{
|
||||||
<< "'"
|
context.tdb.update (*task);
|
||||||
<< std::endl;
|
|
||||||
|
if (context.config.get ("echo.command", true))
|
||||||
|
out << "Annotated "
|
||||||
|
<< task->id
|
||||||
|
<< " with '"
|
||||||
|
<< task->get ("description")
|
||||||
|
<< "'"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.tdb.commit ();
|
context.tdb.commit ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue