mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Integration - "tags" report
- The "tags" report is now working under 1.8.0.
This commit is contained in:
parent
fb5fe5f5b4
commit
aff828c51b
4 changed files with 15 additions and 14 deletions
|
@ -163,8 +163,8 @@ void Context::dispatch ()
|
|||
if (command == "export") { out = handleExport (tdb, task); }
|
||||
*/
|
||||
if (cmd.command == "projects") { out = handleProjects (); }
|
||||
else if (cmd.command == "tags") { out = handleTags (); }
|
||||
/*
|
||||
else if (command == "tags") { out = handleTags (tdb, task); }
|
||||
else if (command == "info") { out = handleInfo (tdb, task); }
|
||||
else if (command == "stats") { out = handleReportStats (tdb, task); }
|
||||
else if (command == "history") { out = handleReportHistory (tdb, task); }
|
||||
|
|
|
@ -101,6 +101,7 @@ std::string handleProjects ()
|
|||
std::vector <T2> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
int quantity = context.tdb.load (tasks, context.filter);
|
||||
context.tdb.unlock ();
|
||||
|
||||
// Scan all the tasks for their project name, building a map using project
|
||||
// names as keys.
|
||||
|
@ -144,31 +145,31 @@ std::string handleProjects ()
|
|||
out << "No projects."
|
||||
<< std::endl;
|
||||
|
||||
context.tdb.unlock ();
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string handleTags (TDB& tdb, T& task)
|
||||
std::string handleTags ()
|
||||
{
|
||||
std::stringstream out;
|
||||
|
||||
// Get all the tasks.
|
||||
std::vector <T> tasks;
|
||||
tdb.pendingT (tasks);
|
||||
context.filter.push_back (Att ("status", "pending"));
|
||||
|
||||
std::vector <T2> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
int quantity = context.tdb.load (tasks, context.filter);
|
||||
context.tdb.unlock ();
|
||||
|
||||
// Scan all the tasks for their project name, building a map using project
|
||||
// names as keys.
|
||||
std::map <std::string, std::string> unique;
|
||||
for (unsigned int i = 0; i < tasks.size (); ++i)
|
||||
foreach (t, tasks)
|
||||
{
|
||||
T task (tasks[i]);
|
||||
|
||||
std::vector <std::string> tags;
|
||||
task.getTags (tags);
|
||||
t->getTags (tags);
|
||||
|
||||
for (unsigned int t = 0; t < tags.size (); ++t)
|
||||
unique[tags[t]] = "";
|
||||
foreach (tag, tags)
|
||||
unique[*tag] = "";
|
||||
}
|
||||
|
||||
// Render a list of tag names from the map.
|
||||
|
@ -180,6 +181,7 @@ std::string handleTags (TDB& tdb, T& task)
|
|||
out << optionalBlankLine ()
|
||||
<< unique.size ()
|
||||
<< (unique.size () == 1 ? " tag" : " tags")
|
||||
<< " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")"
|
||||
<< std::endl;
|
||||
else
|
||||
out << "No tags."
|
||||
|
|
|
@ -453,7 +453,6 @@ std::string runTaskCommand (
|
|||
|
||||
// Read-only commands with no side effects.
|
||||
if (command == "export") { out = handleExport (tdb, task); }
|
||||
else if (command == "tags") { out = handleTags (tdb, task); }
|
||||
else if (command == "info") { out = handleInfo (tdb, task); }
|
||||
else if (command == "stats") { out = handleReportStats (tdb, task); }
|
||||
else if (command == "history") { out = handleReportHistory (tdb, task); }
|
||||
|
|
|
@ -69,7 +69,7 @@ std::string handleExport (TDB&, T&);
|
|||
std::string handleDone (TDB&, T&);
|
||||
std::string handleModify (TDB&, T&);
|
||||
std::string handleProjects ();
|
||||
std::string handleTags (TDB&, T&);
|
||||
std::string handleTags ();
|
||||
std::string handleUndelete (TDB&, T&);
|
||||
std::string handleVersion ();
|
||||
std::string handleDelete (TDB&, T&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue