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:
Wilhelm Schuermann 2015-05-31 16:05:54 +02:00
parent 9067194390
commit f4361d5c65
2 changed files with 7 additions and 2 deletions

View file

@ -351,6 +351,9 @@ existing ones. Tasks are identified by their UUID.
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
few example scripts, such as:

View file

@ -34,6 +34,7 @@
#include <i18n.h>
#include <main.h>
#include <CmdImport.h>
#include <CmdModify.h>
extern Context context;
@ -122,9 +123,10 @@ int CmdImport::import (std::vector <std::string>& lines)
task.set ("modified", before.get ("modified"));
if (taskDiff (before, task))
{
context.tdb2.modify (task);
CmdModify modHelper;
modHelper.checkConsistency (before, task);
count += modHelper.modifyAndUpdate (before, task);
std::cout << " mod ";
++count;
}
else
{