mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 16:53:08 +02:00
Enhancement - confirmation
- Added tri-state confirmation to append command.
This commit is contained in:
parent
1f3092469e
commit
a2cc75d2c7
1 changed files with 20 additions and 10 deletions
|
@ -872,6 +872,10 @@ std::string handleAppend ()
|
||||||
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 ();
|
||||||
|
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
foreach (other, all)
|
foreach (other, all)
|
||||||
|
@ -881,6 +885,8 @@ std::string handleAppend ()
|
||||||
task->get ("parent") == other->get ("parent")) || // Sibling
|
task->get ("parent") == other->get ("parent")) || // Sibling
|
||||||
other->get ("uuid") == task->get ("parent")) // Parent
|
other->get ("uuid") == task->get ("parent")) // Parent
|
||||||
{
|
{
|
||||||
|
Task before (*other);
|
||||||
|
|
||||||
// A non-zero value forces a file write.
|
// A non-zero value forces a file write.
|
||||||
int changes = 0;
|
int changes = 0;
|
||||||
|
|
||||||
|
@ -889,7 +895,10 @@ std::string handleAppend ()
|
||||||
changes += deltaTags (*other);
|
changes += deltaTags (*other);
|
||||||
changes += deltaAttributes (*other);
|
changes += deltaAttributes (*other);
|
||||||
|
|
||||||
if (changes)
|
if (taskDiff (before, *other))
|
||||||
|
{
|
||||||
|
std::string question = taskDifferences (before, *other) + "Are you sure?";
|
||||||
|
if (changes && permission.confirmed (question))
|
||||||
{
|
{
|
||||||
context.tdb.update (*other);
|
context.tdb.update (*other);
|
||||||
|
|
||||||
|
@ -899,12 +908,13 @@ std::string handleAppend ()
|
||||||
<< "' to task "
|
<< "' to task "
|
||||||
<< other->id
|
<< other->id
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
context.tdb.commit ();
|
context.tdb.commit ();
|
||||||
context.tdb.unlock ();
|
context.tdb.unlock ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue