mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TW-303: Make "task import" update existing tasks
This commit is contained in:
parent
45088dc9ce
commit
9d6067e2fe
7 changed files with 50 additions and 19 deletions
|
@ -110,11 +110,22 @@ int CmdImport::import (std::vector <std::string>& lines)
|
|||
|
||||
// Parse the whole thing.
|
||||
Task task (object);
|
||||
context.tdb2.add (task);
|
||||
|
||||
// Check whether the imported task is new or a modified existing task.
|
||||
Task dummy;
|
||||
if (context.tdb2.get (task.get ("uuid"), dummy))
|
||||
{
|
||||
context.tdb2.modify (task);
|
||||
std::cout << " mod ";
|
||||
}
|
||||
else
|
||||
{
|
||||
context.tdb2.add (task);
|
||||
std::cout << " add ";
|
||||
}
|
||||
|
||||
++count;
|
||||
std::cout << " "
|
||||
<< task.get ("uuid")
|
||||
std::cout << task.get ("uuid")
|
||||
<< " "
|
||||
<< task.get ("description")
|
||||
<< "\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue