mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 00:57:19 +02:00
Command: info
- Converted to use TDB2.
This commit is contained in:
parent
0dd4e6d360
commit
8ec130d3c0
1 changed files with 11 additions and 24 deletions
|
@ -60,28 +60,22 @@ int CmdInfo::execute (std::string& output)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
// Get all the tasks.
|
|
||||||
std::vector <Task> tasks;
|
|
||||||
context.tdb.lock (context.config.getBoolean ("locking"));
|
|
||||||
handleRecurrence ();
|
|
||||||
context.tdb.load (tasks);
|
|
||||||
context.tdb.commit ();
|
|
||||||
context.tdb.unlock ();
|
|
||||||
|
|
||||||
// Apply filter.
|
// Apply filter.
|
||||||
std::vector <Task> filtered;
|
std::vector <Task> filtered;
|
||||||
filter (tasks, filtered);
|
filter (filtered);
|
||||||
|
|
||||||
// Read the undo file.
|
if (! filtered.size ())
|
||||||
std::vector <std::string> undo;
|
|
||||||
if (context.config.getBoolean ("journal.info"))
|
|
||||||
{
|
{
|
||||||
Directory location (context.config.get ("data.location"));
|
context.footnote (STRING_FEEDBACK_NO_MATCH);
|
||||||
std::string undoFile = location._data + "/undo.data";
|
rc = 1;
|
||||||
File::read (undoFile, undo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the task.
|
// Get the undo data.
|
||||||
|
std::vector <std::string> undo;
|
||||||
|
if (context.config.getBoolean ("journal.info"))
|
||||||
|
undo = context.tdb2.undo.get_lines ();
|
||||||
|
|
||||||
|
// Render each task.
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
std::vector <Task>::iterator task;
|
std::vector <Task>::iterator task;
|
||||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||||
|
@ -100,10 +94,9 @@ int CmdInfo::execute (std::string& output)
|
||||||
}
|
}
|
||||||
|
|
||||||
Date now;
|
Date now;
|
||||||
int row;
|
|
||||||
|
|
||||||
// id
|
// id
|
||||||
row = view.addRow ();
|
int row = view.addRow ();
|
||||||
view.set (row, 0, STRING_COLUMN_LABEL_ID);
|
view.set (row, 0, STRING_COLUMN_LABEL_ID);
|
||||||
view.set (row, 1, (task->id ? format (task->id) : "-"));
|
view.set (row, 1, (task->id ? format (task->id) : "-"));
|
||||||
|
|
||||||
|
@ -401,12 +394,6 @@ int CmdInfo::execute (std::string& output)
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! filtered.size ())
|
|
||||||
{
|
|
||||||
context.footnote (STRING_FEEDBACK_NO_MATCH);
|
|
||||||
rc = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
output = out.str ();
|
output = out.str ();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue