From bd1661c2b0e1e239242200e8dbc8ab2a6e7ae691 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 28 Jan 2017 20:35:50 -0500 Subject: [PATCH] CmdCommands: Code cleanup --- src/commands/CmdCommands.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/CmdCommands.cpp b/src/commands/CmdCommands.cpp index 36f79ac19..4f0156380 100644 --- a/src/commands/CmdCommands.cpp +++ b/src/commands/CmdCommands.cpp @@ -85,7 +85,7 @@ int CmdCommands::execute (std::string& output) for (auto& command : context.commands) { - int row = view.addRow (); + auto row = view.addRow (); view.set (row, 0, command.first); view.set (row, 1, Command::categoryNames.at (command.second->category ())); @@ -144,15 +144,14 @@ int CmdCompletionCommands::execute (std::string& output) { // Get a list of all commands. std::vector commands; - - for (auto& command : context.commands) + for (const auto& command : context.commands) commands.push_back (command.first); // Sort alphabetically. std::sort (commands.begin (), commands.end ()); std::stringstream out; - for (auto& c : commands) + for (const auto& c : commands) out << c << '\n'; output = out.str (); @@ -179,6 +178,7 @@ CmdZshCommands::CmdZshCommands () struct ZshCommand { bool operator< (const struct ZshCommand&) const; + Command::Category _category; std::string _command; std::string _description; @@ -222,7 +222,7 @@ int CmdZshCommands::execute (std::string& output) // Emit the commands in order. std::stringstream out; - for (auto& zc : commands) + for (const auto& zc : commands) out << zc._command << ':' << Command::categoryNames.at (zc._category) << ':' << zc._description << '\n';