mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CmdExport: Simplified looping with 'auto'
This commit is contained in:
parent
20493ec7d8
commit
25b7f42810
1 changed files with 10 additions and 9 deletions
|
@ -79,18 +79,19 @@ int CmdExport::execute (std::string& output)
|
|||
output += "[\n";
|
||||
|
||||
int counter = 0;
|
||||
for (auto task = filtered.begin (); task != filtered.end (); ++task)
|
||||
for (auto& task : filtered)
|
||||
{
|
||||
if (task != filtered.begin ())
|
||||
{
|
||||
if (json_array)
|
||||
output += ",";
|
||||
output += "\n";
|
||||
}
|
||||
if (counter)
|
||||
{
|
||||
if (json_array)
|
||||
output += ",";
|
||||
output += "\n";
|
||||
}
|
||||
|
||||
output += task->composeJSON (true);
|
||||
output += task.composeJSON (true);
|
||||
|
||||
if (limit && ++counter >= limit)
|
||||
++counter;
|
||||
if (limit && counter >= limit)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue