mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TW-257
- TW-257 limit: not working properly (thanks to Aikido Guy).
This commit is contained in:
parent
7ac533a82d
commit
222c357c0a
2 changed files with 10 additions and 2 deletions
|
@ -53,8 +53,11 @@ int CmdExport::execute (std::string& output)
|
|||
std::vector <Task> filtered;
|
||||
filter.subset (filtered);
|
||||
|
||||
// Note: "limit:" feature not supported.
|
||||
// TODO Why not?
|
||||
// Obey 'limit:N'.
|
||||
int rows = 0;
|
||||
int lines = 0;
|
||||
context.getLimits (rows, lines);
|
||||
int limit = (rows > lines ? rows : lines);
|
||||
|
||||
// Is output contained within a JSON array?
|
||||
bool json_array = context.config.getBoolean ("json.array");
|
||||
|
@ -63,6 +66,7 @@ int CmdExport::execute (std::string& output)
|
|||
if (json_array)
|
||||
output += "[\n";
|
||||
|
||||
int counter = 0;
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
|
@ -70,6 +74,9 @@ int CmdExport::execute (std::string& output)
|
|||
output += ",\n";
|
||||
|
||||
output += task->composeJSON (true);
|
||||
|
||||
if (limit && ++counter >= limit)
|
||||
break;
|
||||
}
|
||||
|
||||
if (filtered.size ())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue