mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 15:47: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;
|
||||
|
||||
// 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.
|
||||
std::vector <Task> filtered;
|
||||
filter (tasks, filtered);
|
||||
filter (filtered);
|
||||
|
||||
// Read the undo file.
|
||||
std::vector <std::string> undo;
|
||||
if (context.config.getBoolean ("journal.info"))
|
||||
if (! filtered.size ())
|
||||
{
|
||||
Directory location (context.config.get ("data.location"));
|
||||
std::string undoFile = location._data + "/undo.data";
|
||||
File::read (undoFile, undo);
|
||||
context.footnote (STRING_FEEDBACK_NO_MATCH);
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
// 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::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
|
@ -100,10 +94,9 @@ int CmdInfo::execute (std::string& output)
|
|||
}
|
||||
|
||||
Date now;
|
||||
int row;
|
||||
|
||||
// id
|
||||
row = view.addRow ();
|
||||
int row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_ID);
|
||||
view.set (row, 1, (task->id ? format (task->id) : "-"));
|
||||
|
||||
|
@ -401,12 +394,6 @@ int CmdInfo::execute (std::string& output)
|
|||
<< "\n";
|
||||
}
|
||||
|
||||
if (! filtered.size ())
|
||||
{
|
||||
context.footnote (STRING_FEEDBACK_NO_MATCH);
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
output = out.str ();
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue