mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Task Validation
- Cleaned up the 'append' and 'prepend' commands due to the new validation.
This commit is contained in:
parent
66f8591fcd
commit
885bde51f1
2 changed files with 2 additions and 12 deletions
|
@ -79,7 +79,6 @@ int CmdAppend::execute (std::string& output)
|
||||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||||
{
|
{
|
||||||
modify_task_description_append (*task, modifications);
|
modify_task_description_append (*task, modifications);
|
||||||
apply_defaults (*task);
|
|
||||||
++changes;
|
++changes;
|
||||||
context.tdb2.modify (*task);
|
context.tdb2.modify (*task);
|
||||||
|
|
||||||
|
@ -91,14 +90,10 @@ int CmdAppend::execute (std::string& output)
|
||||||
|
|
||||||
// Apply other deltas.
|
// Apply other deltas.
|
||||||
modify_task_description_append (*sibling, modifications);
|
modify_task_description_append (*sibling, modifications);
|
||||||
apply_defaults (*sibling);
|
|
||||||
++changes;
|
++changes;
|
||||||
|
|
||||||
if (taskDiff (before, *sibling))
|
if (taskDiff (before, *sibling))
|
||||||
{
|
{
|
||||||
// Only allow valid tasks.
|
|
||||||
sibling->validate ();
|
|
||||||
|
|
||||||
if (changes && permission.confirmed (before, taskDifferences (before, *sibling) + "Proceed with change?"))
|
if (changes && permission.confirmed (before, taskDifferences (before, *sibling) + "Proceed with change?"))
|
||||||
{
|
{
|
||||||
context.tdb2.modify (*sibling);
|
context.tdb2.modify (*sibling);
|
||||||
|
|
|
@ -79,9 +79,8 @@ int CmdPrepend::execute (std::string& output)
|
||||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||||
{
|
{
|
||||||
modify_task_description_prepend (*task, modifications);
|
modify_task_description_prepend (*task, modifications);
|
||||||
apply_defaults (*task);
|
|
||||||
++changes;
|
|
||||||
context.tdb2.modify (*task);
|
context.tdb2.modify (*task);
|
||||||
|
++changes;
|
||||||
|
|
||||||
std::vector <Task> siblings = context.tdb2.siblings (*task);
|
std::vector <Task> siblings = context.tdb2.siblings (*task);
|
||||||
std::vector <Task>::iterator sibling;
|
std::vector <Task>::iterator sibling;
|
||||||
|
@ -91,17 +90,13 @@ int CmdPrepend::execute (std::string& output)
|
||||||
|
|
||||||
// Apply other deltas.
|
// Apply other deltas.
|
||||||
modify_task_description_prepend (*sibling, modifications);
|
modify_task_description_prepend (*sibling, modifications);
|
||||||
apply_defaults (*sibling);
|
|
||||||
++changes;
|
|
||||||
|
|
||||||
if (taskDiff (before, *sibling))
|
if (taskDiff (before, *sibling))
|
||||||
{
|
{
|
||||||
// Only allow valid tasks.
|
|
||||||
sibling->validate ();
|
|
||||||
|
|
||||||
if (changes && permission.confirmed (before, taskDifferences (before, *sibling) + "Proceed with change?"))
|
if (changes && permission.confirmed (before, taskDifferences (before, *sibling) + "Proceed with change?"))
|
||||||
{
|
{
|
||||||
context.tdb2.modify (*sibling);
|
context.tdb2.modify (*sibling);
|
||||||
|
++changes;
|
||||||
|
|
||||||
if (context.config.getBoolean ("echo.command"))
|
if (context.config.getBoolean ("echo.command"))
|
||||||
out << format (STRING_CMD_PREPEND_DONE, sibling->id)
|
out << format (STRING_CMD_PREPEND_DONE, sibling->id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue