mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +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
|
@ -305,13 +305,12 @@ int CmdDiagnostics::execute (std::string& output)
|
|||
std::vector <std::string> hooks = context.hooks.list ();
|
||||
if (hooks.size ())
|
||||
{
|
||||
std::vector <std::string>::iterator h;
|
||||
for (h = hooks.begin (); h != hooks.end (); ++h)
|
||||
for (auto& hook : hooks)
|
||||
{
|
||||
Path p (*h);
|
||||
Path p (hook);
|
||||
std::string name = p.name ();
|
||||
out << " "
|
||||
<< *h
|
||||
<< hook
|
||||
<< (p.executable () ? format (" ({1})", STRING_CMD_DIAG_HOOK_EXEC) : format (" ({1})", STRING_CMD_DIAG_HOOK_NO_EXEC))
|
||||
<< (p.is_link () ? format (" ({1})", STRING_CMD_DIAG_HOOK_SYMLINK) : "")
|
||||
<< ((name.substr (0, 6) == "on-add" ||
|
||||
|
@ -345,10 +344,9 @@ int CmdDiagnostics::execute (std::string& output)
|
|||
std::map <std::string, int> seen;
|
||||
std::vector <std::string> dups;
|
||||
std::string uuid;
|
||||
std::vector <Task>::iterator i;
|
||||
for (i = all.begin (); i != all.end (); ++i)
|
||||
for (auto& i : all)
|
||||
{
|
||||
uuid = i->get ("uuid");
|
||||
uuid = i.get ("uuid");
|
||||
if (seen.find (uuid) != seen.end ())
|
||||
dups.push_back (uuid);
|
||||
else
|
||||
|
@ -361,9 +359,8 @@ int CmdDiagnostics::execute (std::string& output)
|
|||
|
||||
if (dups.size ())
|
||||
{
|
||||
std::vector <std::string>::iterator d;
|
||||
for (d = dups.begin (); d != dups.end (); ++d)
|
||||
out << " " << format (STRING_CMD_DIAG_UUID_DUP, *d) << "\n";
|
||||
for (auto& d : dups)
|
||||
out << " " << format (STRING_CMD_DIAG_UUID_DUP, d) << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue