Import: Reuse CmdModify's checks
- Make updating tasks with "task import" run the same checks and update the same things as "task modify" would.
This commit is contained in:
@@ -351,6 +351,9 @@ existing ones. Tasks are identified by their UUID.
|
|||||||
|
|
||||||
If no file or "-" is specified, import tasks from STDIN.
|
If no file or "-" is specified, import tasks from STDIN.
|
||||||
|
|
||||||
|
Setting rc.recurrence.confirmation to an appropriate level is recommended
|
||||||
|
if import is to be used in automated workflows. See taskrc(5).
|
||||||
|
|
||||||
For importing other file formats, the standard task release comes with a
|
For importing other file formats, the standard task release comes with a
|
||||||
few example scripts, such as:
|
few example scripts, such as:
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
#include <CmdImport.h>
|
#include <CmdImport.h>
|
||||||
|
#include <CmdModify.h>
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
|
||||||
@@ -122,9 +123,10 @@ int CmdImport::import (std::vector <std::string>& lines)
|
|||||||
task.set ("modified", before.get ("modified"));
|
task.set ("modified", before.get ("modified"));
|
||||||
if (taskDiff (before, task))
|
if (taskDiff (before, task))
|
||||||
{
|
{
|
||||||
context.tdb2.modify (task);
|
CmdModify modHelper;
|
||||||
|
modHelper.checkConsistency (before, task);
|
||||||
|
count += modHelper.modifyAndUpdate (before, task);
|
||||||
std::cout << " mod ";
|
std::cout << " mod ";
|
||||||
++count;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user