mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-04 12:28:35 +02:00
TDB2
- Converted 'tags' and '_tags' commands to TDB2.
This commit is contained in:
parent
a04ce55544
commit
72627268dc
1 changed files with 19 additions and 17 deletions
|
@ -54,16 +54,18 @@ int CmdTags::execute (std::string& output)
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
std::vector <Task> tasks;
|
// Get all the tasks.
|
||||||
context.tdb.lock (context.config.getBoolean ("locking"));
|
std::vector <Task> tasks = context.tdb2.pending.get_tasks ();
|
||||||
int quantity = 0;
|
|
||||||
if (context.config.getBoolean ("list.all.tags"))
|
|
||||||
quantity += context.tdb.load (tasks);
|
|
||||||
else
|
|
||||||
quantity += context.tdb.loadPending (tasks);
|
|
||||||
|
|
||||||
context.tdb.commit ();
|
if (context.config.getBoolean ("list.all.tags"))
|
||||||
context.tdb.unlock ();
|
{
|
||||||
|
std::vector <Task> extra = context.tdb2.completed.get_tasks ();
|
||||||
|
std::vector <Task>::iterator task;
|
||||||
|
for (task = extra.begin (); task != extra.end (); ++task)
|
||||||
|
tasks.push_back (*task);
|
||||||
|
}
|
||||||
|
|
||||||
|
int quantity = tasks.size ();
|
||||||
|
|
||||||
// Apply filter.
|
// Apply filter.
|
||||||
std::vector <Task> filtered;
|
std::vector <Task> filtered;
|
||||||
|
@ -149,16 +151,16 @@ CmdCompletionTags::CmdCompletionTags ()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int CmdCompletionTags::execute (std::string& output)
|
int CmdCompletionTags::execute (std::string& output)
|
||||||
{
|
{
|
||||||
std::vector <Task> tasks;
|
// Get all the tasks.
|
||||||
context.tdb.lock (context.config.getBoolean ("locking"));
|
std::vector <Task> tasks = context.tdb2.pending.get_tasks ();
|
||||||
|
|
||||||
if (context.config.getBoolean ("complete.all.tags"))
|
if (context.config.getBoolean ("complete.all.tags"))
|
||||||
context.tdb.load (tasks);
|
{
|
||||||
else
|
std::vector <Task> extra = context.tdb2.completed.get_tasks ();
|
||||||
context.tdb.loadPending (tasks);
|
std::vector <Task>::iterator task;
|
||||||
|
for (task = extra.begin (); task != extra.end (); ++task)
|
||||||
context.tdb.commit ();
|
tasks.push_back (*task);
|
||||||
context.tdb.unlock ();
|
}
|
||||||
|
|
||||||
// Apply filter.
|
// Apply filter.
|
||||||
std::vector <Task> filtered;
|
std::vector <Task> filtered;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue