mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 15:47:19 +02:00
Enhancements - info report
- Implemented info report. - Removed odd Subst and Sequence objects from Task - are they just vestigial limbs, or did I add them for a good reason? They are gone now. - Added Filter::applySequence to replace old filterSequence. - Removed obsolete report.cpp filter function.
This commit is contained in:
parent
5288e167d0
commit
d99dec5556
9 changed files with 123 additions and 257 deletions
|
@ -162,40 +162,38 @@ std::string Context::dispatch ()
|
||||||
int gcMod = 0; // Change occurred by way of gc.
|
int gcMod = 0; // Change occurred by way of gc.
|
||||||
std::string out;
|
std::string out;
|
||||||
|
|
||||||
// Read-only commands with no side effects.
|
// TODO Look at this thing. It just cries out for a dispatch table.
|
||||||
/*
|
/*
|
||||||
if (cmd.command == "export") { out = handleExport (); }
|
if (cmd.command == "export") { out = handleExport (); }
|
||||||
*/
|
*/
|
||||||
if (cmd.command == "projects") { out = handleProjects (); }
|
if (cmd.command == "projects") { out = handleProjects (); }
|
||||||
else if (cmd.command == "tags") { out = handleTags (); }
|
else if (cmd.command == "tags") { out = handleTags (); }
|
||||||
else if (cmd.command == "colors") { out = handleColor (); }
|
else if (cmd.command == "colors") { out = handleColor (); }
|
||||||
else if (cmd.command == "version") { out = handleVersion (); }
|
else if (cmd.command == "version") { out = handleVersion (); }
|
||||||
else if (cmd.command == "help") { out = longUsage (); }
|
else if (cmd.command == "help") { out = longUsage (); }
|
||||||
else if (cmd.command == "stats") { out = handleReportStats (); }
|
else if (cmd.command == "stats") { out = handleReportStats (); }
|
||||||
|
else if (cmd.command == "info") { out = handleInfo (); }
|
||||||
/*
|
/*
|
||||||
else if (cmd.command == "info") { out = handleInfo (); }
|
else if (cmd.command == "history") { out = handleReportHistory (); }
|
||||||
else if (cmd.command == "history") { out = handleReportHistory (); }
|
else if (cmd.command == "ghistory") { out = handleReportGHistory (); }
|
||||||
else if (cmd.command == "ghistory") { out = handleReportGHistory (); }
|
else if (cmd.command == "calendar") { out = handleReportCalendar (); }
|
||||||
else if (cmd.command == "calendar") { out = handleReportCalendar (); }
|
else if (cmd.command == "summary") { out = handleReportSummary (); }
|
||||||
else if (cmd.command == "summary") { out = handleReportSummary (); }
|
else if (cmd.command == "timesheet") { out = handleReportTimesheet (); }
|
||||||
else if (cmd.command == "timesheet") { out = handleReportTimesheet (); }
|
|
||||||
*/
|
*/
|
||||||
|
else if (cmd.command == "add") { out = handleAdd (); }
|
||||||
// Commands that cause updates.
|
|
||||||
else if (cmd.command == "add") { out = handleAdd (); }
|
|
||||||
/*
|
/*
|
||||||
else if (command == "" && task.getId ()) { out = handleModify (); }
|
else if (cmd.command == "" && task.getId ()) { out = handleModify (); }
|
||||||
else if (command == "append") { out = handleAppend (); }
|
else if (cmd.command == "append") { out = handleAppend (); }
|
||||||
else if (command == "annotate") { out = handleAnnotate (); }
|
else if (cmd.command == "annotate") { out = handleAnnotate (); }
|
||||||
else if (command == "done") { out = handleDone (); }
|
else if (cmd.command == "done") { out = handleDone (); }
|
||||||
else if (command == "undelete") { out = handleUndelete (); }
|
else if (cmd.command == "undelete") { out = handleUndelete (); }
|
||||||
else if (command == "delete") { out = handleDelete (); }
|
else if (cmd.command == "delete") { out = handleDelete (); }
|
||||||
else if (command == "start") { out = handleStart (); }
|
else if (cmd.command == "start") { out = handleStart (); }
|
||||||
else if (command == "stop") { out = handleStop (); }
|
else if (cmd.command == "stop") { out = handleStop (); }
|
||||||
else if (command == "undo") { out = handleUndo (); }
|
else if (cmd.command == "undo") { out = handleUndo (); }
|
||||||
else if (command == "import") { out = handleImport (); }
|
else if (cmd.command == "import") { out = handleImport (); }
|
||||||
else if (command == "duplicate") { out = handleDuplicate (); }
|
else if (cmd.command == "duplicate") { out = handleDuplicate (); }
|
||||||
else if (command == "edit") { out = handleEdit (); }
|
else if (cmd.command == "edit") { out = handleEdit (); }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Command that display IDs and therefore need TDB::gc first.
|
// Command that display IDs and therefore need TDB::gc first.
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
#include "Filter.h"
|
#include "Filter.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// For every Att in the filter, lookup the equivalent in Record, and perform a
|
// For every Att in the filter, lookup the equivalent in Record, and perform a
|
||||||
|
@ -54,3 +56,42 @@ bool Filter::pass (const Record& record) const
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void Filter::applySequence (std::vector<Task>& all, Sequence& sequence)
|
||||||
|
{
|
||||||
|
std::vector <Task> filtered;
|
||||||
|
foreach (task, all)
|
||||||
|
foreach (i, sequence)
|
||||||
|
if (task->id == *i)
|
||||||
|
filtered.push_back (*task);
|
||||||
|
|
||||||
|
if (sequence.size () != filtered.size ())
|
||||||
|
{
|
||||||
|
std::vector <int> filteredSequence;
|
||||||
|
foreach (task, filtered)
|
||||||
|
filteredSequence.push_back (task->id);
|
||||||
|
|
||||||
|
std::vector <int> left;
|
||||||
|
std::vector <int> right;
|
||||||
|
listDiff (filteredSequence, (std::vector <int>&)sequence, left, right);
|
||||||
|
if (left.size ())
|
||||||
|
throw std::string ("Sequence filtering error - please report this error");
|
||||||
|
|
||||||
|
if (right.size ())
|
||||||
|
{
|
||||||
|
std::stringstream out;
|
||||||
|
out << "Task";
|
||||||
|
|
||||||
|
if (right.size () > 1) out << "s";
|
||||||
|
|
||||||
|
foreach (r, right)
|
||||||
|
out << " " << *r;
|
||||||
|
|
||||||
|
out << " not found";
|
||||||
|
throw out.str ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
all = filtered;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -29,12 +29,14 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Att.h"
|
#include "Att.h"
|
||||||
|
#include "Task.h"
|
||||||
#include "Record.h"
|
#include "Record.h"
|
||||||
|
|
||||||
class Filter : public std::vector <Att>
|
class Filter : public std::vector <Att>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool pass (const Record&) const;
|
bool pass (const Record&) const;
|
||||||
|
void applySequence (std::vector<Task>&, Sequence&);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -171,7 +171,7 @@ int TDB2::loadPending (std::vector <Task>& tasks, Filter& filter)
|
||||||
// TODO Add hidden attribute indicating source?
|
// TODO Add hidden attribute indicating source?
|
||||||
line[length - 1] = '\0'; // Kill \n
|
line[length - 1] = '\0'; // Kill \n
|
||||||
Task task (line);
|
Task task (line);
|
||||||
task.id (mId++);
|
task.id = mId++;
|
||||||
|
|
||||||
if (filter.pass (task))
|
if (filter.pass (task))
|
||||||
tasks.push_back (task);
|
tasks.push_back (task);
|
||||||
|
@ -221,7 +221,7 @@ int TDB2::loadCompleted (std::vector <Task>& tasks, Filter& filter)
|
||||||
// TODO Add hidden attribute indicating source?
|
// TODO Add hidden attribute indicating source?
|
||||||
line[length - 1] = '\0'; // Kill \n
|
line[length - 1] = '\0'; // Kill \n
|
||||||
Task task (line);
|
Task task (line);
|
||||||
task.id (mId++);
|
task.id = mId++;
|
||||||
|
|
||||||
if (filter.pass (task))
|
if (filter.pass (task))
|
||||||
tasks.push_back (task);
|
tasks.push_back (task);
|
||||||
|
|
20
src/Task.cpp
20
src/Task.cpp
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Task::Task ()
|
Task::Task ()
|
||||||
|
: id (0)
|
||||||
{
|
{
|
||||||
// Each new task gets a uuid.
|
// Each new task gets a uuid.
|
||||||
set ("uuid", uuid ());
|
set ("uuid", uuid ());
|
||||||
|
@ -55,19 +56,6 @@ Task::Task (const std::string& input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
Task& Task::operator= (const Task& other)
|
|
||||||
{
|
|
||||||
throw std::string ("unimplemented Task::operator=");
|
|
||||||
if (this != &other)
|
|
||||||
{
|
|
||||||
sequence = other.sequence;
|
|
||||||
subst = other.subst;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Task::~Task ()
|
Task::~Task ()
|
||||||
{
|
{
|
||||||
|
@ -430,11 +418,7 @@ void Task::removeTag (const std::string& tag)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Task::validate () const
|
void Task::validate () const
|
||||||
{
|
{
|
||||||
// Every task needs an ID.
|
// TODO Every task needs an ID.
|
||||||
/*
|
|
||||||
if (sequence[0] == 0)
|
|
||||||
throw std::string ("Every task needs an ID.");
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO Every task needs an ID, entry and description attribute.
|
// TODO Every task needs an ID, entry and description attribute.
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ class Task : public Record
|
||||||
public:
|
public:
|
||||||
Task (); // Default constructor
|
Task (); // Default constructor
|
||||||
Task (const std::string&); // Parse
|
Task (const std::string&); // Parse
|
||||||
Task& operator= (const Task&); // Assignment operator
|
|
||||||
~Task (); // Destructor
|
~Task (); // Destructor
|
||||||
|
|
||||||
void parse (const std::string&);
|
void parse (const std::string&);
|
||||||
|
@ -47,13 +46,9 @@ public:
|
||||||
enum status {pending, completed, deleted, recurring /* , retired, deferred */};
|
enum status {pending, completed, deleted, recurring /* , retired, deferred */};
|
||||||
|
|
||||||
// Public data.
|
// Public data.
|
||||||
Sequence sequence;
|
int id;
|
||||||
Subst subst;
|
|
||||||
|
|
||||||
// Series of helper functions.
|
// Series of helper functions.
|
||||||
int id () const { return sequence.size () ? sequence[0] : 0; }
|
|
||||||
void id (int anotherId) { sequence.push_back (anotherId); }
|
|
||||||
|
|
||||||
static status textToStatus (const std::string&);
|
static status textToStatus (const std::string&);
|
||||||
static std::string statusToText (status);
|
static std::string statusToText (status);
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ std::string handleCustomReport (const std::string& report)
|
||||||
table.setColumnJustification (columnCount, Table::right);
|
table.setColumnJustification (columnCount, Table::right);
|
||||||
|
|
||||||
for (unsigned int row = 0; row < tasks.size(); ++row)
|
for (unsigned int row = 0; row < tasks.size(); ++row)
|
||||||
table.addCell (row, columnCount, tasks[row].id ());
|
table.addCell (row, columnCount, tasks[row].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (*col == "uuid")
|
else if (*col == "uuid")
|
||||||
|
|
|
@ -90,8 +90,6 @@ std::string handleEdit ();
|
||||||
// report.cpp
|
// report.cpp
|
||||||
std::string shortUsage ();
|
std::string shortUsage ();
|
||||||
std::string longUsage ();
|
std::string longUsage ();
|
||||||
void filterSequence (std::vector<T>&, T&);
|
|
||||||
void filter (std::vector<T>&, T&);
|
|
||||||
std::string handleInfo ();
|
std::string handleInfo ();
|
||||||
std::string handleReportSummary ();
|
std::string handleReportSummary ();
|
||||||
std::string handleReportNext ();
|
std::string handleReportNext ();
|
||||||
|
|
246
src/report.cpp
246
src/report.cpp
|
@ -264,178 +264,26 @@ std::string longUsage ()
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// TODO Obsolete
|
|
||||||
void filterSequence (std::vector<T>& all, T& task)
|
|
||||||
{
|
|
||||||
std::vector <int> sequence = task.getAllIds ();
|
|
||||||
|
|
||||||
std::vector <T> filtered;
|
|
||||||
std::vector <T>::iterator t;
|
|
||||||
for (t = all.begin (); t != all.end (); ++t)
|
|
||||||
{
|
|
||||||
std::vector <int>::iterator s;
|
|
||||||
for (s = sequence.begin (); s != sequence.end (); ++s)
|
|
||||||
if (t->getId () == *s)
|
|
||||||
filtered.push_back (*t);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sequence.size () != filtered.size ())
|
|
||||||
{
|
|
||||||
std::vector <int> filteredSequence;
|
|
||||||
std::vector <T>::iterator fs;
|
|
||||||
for (fs = filtered.begin (); fs != filtered.end (); ++fs)
|
|
||||||
filteredSequence.push_back (fs->getId ());
|
|
||||||
|
|
||||||
std::vector <int> left;
|
|
||||||
std::vector <int> right;
|
|
||||||
listDiff (filteredSequence, sequence, left, right);
|
|
||||||
if (left.size ())
|
|
||||||
throw std::string ("Sequence filtering error - please report this error");
|
|
||||||
|
|
||||||
if (right.size ())
|
|
||||||
{
|
|
||||||
std::stringstream out;
|
|
||||||
out << "Task";
|
|
||||||
|
|
||||||
if (right.size () > 1) out << "s";
|
|
||||||
|
|
||||||
std::vector <int>::iterator s;
|
|
||||||
for (s = right.begin (); s != right.end (); ++s)
|
|
||||||
out << " " << *s;
|
|
||||||
|
|
||||||
out << " not found";
|
|
||||||
throw out.str ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
all = filtered;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// TODO Obsolete
|
|
||||||
void filter (std::vector<T>& all, T& task)
|
|
||||||
{
|
|
||||||
std::vector <T> filtered;
|
|
||||||
|
|
||||||
// Split any description specified into words.
|
|
||||||
std::vector <std::string> descWords;
|
|
||||||
split (descWords, lowerCase (task.getDescription ()), ' ');
|
|
||||||
|
|
||||||
// Get all the tags to match against.
|
|
||||||
std::vector <std::string> tagList;
|
|
||||||
task.getTags (tagList);
|
|
||||||
|
|
||||||
std::vector <std::string> removeTagList;
|
|
||||||
task.getRemoveTags (removeTagList);
|
|
||||||
|
|
||||||
// Get all the attributes to match against.
|
|
||||||
std::map <std::string, std::string> attrList;
|
|
||||||
task.getAttributes (attrList);
|
|
||||||
|
|
||||||
// Iterate over each task, and apply selection criteria.
|
|
||||||
for (unsigned int i = 0; i < all.size (); ++i)
|
|
||||||
{
|
|
||||||
T refTask (all[i]);
|
|
||||||
|
|
||||||
// Apply description filter.
|
|
||||||
std::string desc = lowerCase (refTask.getDescription ());
|
|
||||||
unsigned int matches = 0;
|
|
||||||
for (unsigned int w = 0; w < descWords.size (); ++w)
|
|
||||||
if (desc.find (descWords[w]) != std::string::npos)
|
|
||||||
++matches;
|
|
||||||
|
|
||||||
if (matches == descWords.size ())
|
|
||||||
{
|
|
||||||
// Apply attribute filter.
|
|
||||||
matches = 0;
|
|
||||||
foreach (a, attrList)
|
|
||||||
{
|
|
||||||
if (a->first == "project")
|
|
||||||
{
|
|
||||||
if (a->second.length () <= refTask.getAttribute (a->first).length ())
|
|
||||||
if (a->second == refTask.getAttribute (a->first).substr (0, a->second.length ()))
|
|
||||||
++matches;
|
|
||||||
/*
|
|
||||||
TODO Attempt at allowing "pri:!H", thwarted by a lack of coffee and the
|
|
||||||
validation of "!H" as a priority value. To be revisited soon.
|
|
||||||
{
|
|
||||||
if (a->second[0] == '!') // Inverted search.
|
|
||||||
{
|
|
||||||
if (a->second.substr (1, std::string::npos) != refTask.getAttribute (a->first).substr (0, a->second.length ()))
|
|
||||||
++matches;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (a->second == refTask.getAttribute (a->first).substr (0, a->second.length ()))
|
|
||||||
++matches;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (a->second == refTask.getAttribute (a->first))
|
|
||||||
++matches;
|
|
||||||
/*
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (a->second[0] == '!') // Inverted search.
|
|
||||||
{
|
|
||||||
if (a->second.substr (1, std::string::npos) != refTask.getAttribute (a->first))
|
|
||||||
++matches;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (a->second == refTask.getAttribute (a->first))
|
|
||||||
++matches;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matches == attrList.size ())
|
|
||||||
{
|
|
||||||
// Apply tag filter.
|
|
||||||
matches = 0;
|
|
||||||
for (unsigned int t = 0; t < tagList.size (); ++t)
|
|
||||||
if (refTask.hasTag (tagList[t]))
|
|
||||||
++matches;
|
|
||||||
|
|
||||||
if (matches == tagList.size ())
|
|
||||||
{
|
|
||||||
matches = 0;
|
|
||||||
for (unsigned int t = 0; t < removeTagList.size (); ++t)
|
|
||||||
if (refTask.hasTag (removeTagList[t]))
|
|
||||||
++matches;
|
|
||||||
|
|
||||||
if (matches == 0)
|
|
||||||
filtered.push_back (refTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
all = filtered;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Display all information for the given task.
|
// Display all information for the given task.
|
||||||
std::string handleInfo ()
|
std::string handleInfo ()
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
/*
|
|
||||||
// Get all the tasks.
|
// Get all the tasks.
|
||||||
std::vector <T> tasks;
|
std::vector <Task> tasks;
|
||||||
tdb.allPendingT (tasks);
|
context.tdb.lock (context.config.get ("locking", true));
|
||||||
filterSequence (tasks, task);
|
context.tdb.loadPending (tasks, context.filter);
|
||||||
|
context.tdb.unlock ();
|
||||||
|
|
||||||
|
// Filter sequence.
|
||||||
|
context.filter.applySequence (tasks, context.sequence);
|
||||||
|
|
||||||
// Find the task.
|
// Find the task.
|
||||||
foreach (t, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
T refTask (*t);
|
|
||||||
|
|
||||||
Table table;
|
Table table;
|
||||||
table.setTableWidth (width);
|
table.setTableWidth (context.getWidth ());
|
||||||
table.setDateFormat (context.config.get ("dateformat", "m/d/Y"));
|
table.setDateFormat (context.config.get ("dateformat", "m/d/Y"));
|
||||||
|
|
||||||
table.addColumn ("Name");
|
table.addColumn ("Name");
|
||||||
|
@ -459,89 +307,89 @@ std::string handleInfo ()
|
||||||
|
|
||||||
int row = table.addRow ();
|
int row = table.addRow ();
|
||||||
table.addCell (row, 0, "ID");
|
table.addCell (row, 0, "ID");
|
||||||
table.addCell (row, 1, refTask.getId ());
|
table.addCell (row, 1, task->id);
|
||||||
|
|
||||||
std::string status = refTask.getStatus () == T::pending ? "Pending"
|
std::string status = task->getStatus () == Task::pending ? "Pending"
|
||||||
: refTask.getStatus () == T::completed ? "Completed"
|
: task->getStatus () == Task::completed ? "Completed"
|
||||||
: refTask.getStatus () == T::deleted ? "Deleted"
|
: task->getStatus () == Task::deleted ? "Deleted"
|
||||||
: refTask.getStatus () == T::recurring ? "Recurring"
|
: task->getStatus () == Task::recurring ? "Recurring"
|
||||||
: "";
|
: "";
|
||||||
if (refTask.has ("parent"))
|
if (task->has ("parent"))
|
||||||
status += " (Recurring)";
|
status += " (Recurring)";
|
||||||
|
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Status");
|
table.addCell (row, 0, "Status");
|
||||||
table.addCell (row, 1, status);
|
table.addCell (row, 1, status);
|
||||||
|
|
||||||
std::string description = refTask.getDescription ();
|
std::string description = task->get ("description");
|
||||||
std::string when;
|
std::string when;
|
||||||
std::map <time_t, std::string> annotations;
|
std::vector <Att> annotations;
|
||||||
refTask.getAnnotations (annotations);
|
task->getAnnotations (annotations);
|
||||||
foreach (anno, annotations)
|
foreach (anno, annotations)
|
||||||
{
|
{
|
||||||
Date dt (anno->first);
|
Date dt (::atoi (anno->name ().substr (11, std::string::npos).c_str ()));
|
||||||
when = dt.toString (context.config.get ("dateformat", "m/d/Y"));
|
when = dt.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||||
description += "\n" + when + " " + anno->second;
|
description += "\n" + when + " " + anno->value ();
|
||||||
}
|
}
|
||||||
|
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Description");
|
table.addCell (row, 0, "Description");
|
||||||
table.addCell (row, 1, description);
|
table.addCell (row, 1, description);
|
||||||
|
|
||||||
if (refTask.has ("project"))
|
if (task->has ("project"))
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Project");
|
table.addCell (row, 0, "Project");
|
||||||
table.addCell (row, 1, refTask.getAttribute ("project"));
|
table.addCell (row, 1, task->get ("project"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refTask.has ("priority"))
|
if (task->has ("priority"))
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Priority");
|
table.addCell (row, 0, "Priority");
|
||||||
table.addCell (row, 1, refTask.getAttribute ("priority"));
|
table.addCell (row, 1, task->get ("priority"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refTask.getStatus () == T::recurring ||
|
if (task->getStatus () == Task::recurring ||
|
||||||
refTask.has ("parent"))
|
task->has ("parent"))
|
||||||
{
|
{
|
||||||
if (refTask.has ("recur"))
|
if (task->has ("recur"))
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Recurrence");
|
table.addCell (row, 0, "Recurrence");
|
||||||
table.addCell (row, 1, refTask.getAttribute ("recur"));
|
table.addCell (row, 1, task->get ("recur"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refTask.has ("until"))
|
if (task->has ("until"))
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Recur until");
|
table.addCell (row, 0, "Recur until");
|
||||||
table.addCell (row, 1, refTask.getAttribute ("until"));
|
table.addCell (row, 1, task->get ("until"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refTask.has ("mask"))
|
if (task->has ("mask"))
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Mask");
|
table.addCell (row, 0, "Mask");
|
||||||
table.addCell (row, 1, refTask.getAttribute ("mask"));
|
table.addCell (row, 1, task->get ("mask"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refTask.has ("parent"))
|
if (task->has ("parent"))
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Parent task");
|
table.addCell (row, 0, "Parent task");
|
||||||
table.addCell (row, 1, refTask.getAttribute ("parent"));
|
table.addCell (row, 1, task->get ("parent"));
|
||||||
}
|
}
|
||||||
|
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Mask Index");
|
table.addCell (row, 0, "Mask Index");
|
||||||
table.addCell (row, 1, refTask.getAttribute ("imask"));
|
table.addCell (row, 1, task->get ("imask"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// due (colored)
|
// due (colored)
|
||||||
bool imminent = false;
|
bool imminent = false;
|
||||||
bool overdue = false;
|
bool overdue = false;
|
||||||
std::string due = refTask.getAttribute ("due");
|
std::string due = task->get ("due");
|
||||||
if (due != "")
|
if (due != "")
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
|
@ -568,26 +416,26 @@ std::string handleInfo ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// start
|
// start
|
||||||
if (refTask.has ("start"))
|
if (task->has ("start"))
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Start");
|
table.addCell (row, 0, "Start");
|
||||||
Date dt (::atoi (refTask.getAttribute ("start").c_str ()));
|
Date dt (::atoi (task->get ("start").c_str ()));
|
||||||
table.addCell (row, 1, dt.toString (context.config.get ("dateformat", "m/d/Y")));
|
table.addCell (row, 1, dt.toString (context.config.get ("dateformat", "m/d/Y")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// end
|
// end
|
||||||
if (refTask.has ("end"))
|
if (task->has ("end"))
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "End");
|
table.addCell (row, 0, "End");
|
||||||
Date dt (::atoi (refTask.getAttribute ("end").c_str ()));
|
Date dt (::atoi (task->get ("end").c_str ()));
|
||||||
table.addCell (row, 1, dt.toString (context.config.get ("dateformat", "m/d/Y")));
|
table.addCell (row, 1, dt.toString (context.config.get ("dateformat", "m/d/Y")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// tags ...
|
// tags ...
|
||||||
std::vector <std::string> tags;
|
std::vector <std::string> tags;
|
||||||
refTask.getTags (tags);
|
task->getTags (tags);
|
||||||
if (tags.size ())
|
if (tags.size ())
|
||||||
{
|
{
|
||||||
std::string allTags;
|
std::string allTags;
|
||||||
|
@ -601,16 +449,16 @@ std::string handleInfo ()
|
||||||
// uuid
|
// uuid
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "UUID");
|
table.addCell (row, 0, "UUID");
|
||||||
table.addCell (row, 1, refTask.getUUID ());
|
table.addCell (row, 1, task->get ("uuid"));
|
||||||
|
|
||||||
// entry
|
// entry
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 0, "Entered");
|
table.addCell (row, 0, "Entered");
|
||||||
Date dt (::atoi (refTask.getAttribute ("entry").c_str ()));
|
Date dt (::atoi (task->get ("entry").c_str ()));
|
||||||
std::string entry = dt.toString (context.config.get ("dateformat", "m/d/Y"));
|
std::string entry = dt.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||||
|
|
||||||
std::string age;
|
std::string age;
|
||||||
std::string created = refTask.getAttribute ("entry");
|
std::string created = task->get ("entry");
|
||||||
if (created.length ())
|
if (created.length ())
|
||||||
{
|
{
|
||||||
Date dt (::atoi (created.c_str ()));
|
Date dt (::atoi (created.c_str ()));
|
||||||
|
@ -620,7 +468,7 @@ std::string handleInfo ()
|
||||||
table.addCell (row, 1, entry + " (" + age + ")");
|
table.addCell (row, 1, entry + " (" + age + ")");
|
||||||
|
|
||||||
// fg
|
// fg
|
||||||
std::string color = refTask.getAttribute ("fg");
|
std::string color = task->get ("fg");
|
||||||
if (color != "")
|
if (color != "")
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
|
@ -629,7 +477,7 @@ std::string handleInfo ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// bg
|
// bg
|
||||||
color = refTask.getAttribute ("bg");
|
color = task->get ("bg");
|
||||||
if (color != "")
|
if (color != "")
|
||||||
{
|
{
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
|
@ -644,7 +492,7 @@ std::string handleInfo ()
|
||||||
|
|
||||||
if (! tasks.size ())
|
if (! tasks.size ())
|
||||||
out << "No matches." << std::endl;
|
out << "No matches." << std::endl;
|
||||||
*/
|
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue