mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-07 21:07:20 +02:00
C++11: Cleaned up commands code with range-based for
This commit is contained in:
parent
bd3d58484a
commit
5a57dfd70d
42 changed files with 911 additions and 1065 deletions
|
@ -51,12 +51,11 @@ int CmdReports::execute (std::string& output)
|
|||
std::vector <std::string> reports;
|
||||
|
||||
// Add custom reports.
|
||||
Config::const_iterator i;
|
||||
for (i = context.config.begin (); i != context.config.end (); ++i)
|
||||
for (auto& i : context.config)
|
||||
{
|
||||
if (i->first.substr (0, 7) == "report.")
|
||||
if (i.first.substr (0, 7) == "report.")
|
||||
{
|
||||
std::string report = i->first.substr (7);
|
||||
std::string report = i.first.substr (7);
|
||||
std::string::size_type columns = report.find (".columns");
|
||||
if (columns != std::string::npos)
|
||||
reports.push_back (report.substr (0, columns));
|
||||
|
@ -96,12 +95,11 @@ int CmdReports::execute (std::string& output)
|
|||
view.intraColorOdd (alternate);
|
||||
}
|
||||
|
||||
std::vector <std::string>::iterator report;
|
||||
for (report = reports.begin (); report != reports.end (); ++report)
|
||||
for (auto& report : reports)
|
||||
{
|
||||
int row = view.addRow ();
|
||||
view.set (row, 0, *report);
|
||||
view.set (row, 1, context.commands[*report]->description ());
|
||||
view.set (row, 0, report);
|
||||
view.set (row, 1, context.commands[report]->description ());
|
||||
}
|
||||
|
||||
out << optionalBlankLine ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue