Command: Code cleanup, added ::category accessor

- The Command object failed to initialize all member on construction and
  initialized them out of order (is this still a thing in C++11?).
- The _category was the only member with no accessor, which is not right.
This commit is contained in:
Paul Beckingham 2015-09-06 14:07:21 -04:00
parent 77b17379d6
commit d1fe1279ed
3 changed files with 32 additions and 23 deletions

View file

@ -88,7 +88,7 @@ int CmdCommands::execute (std::string& output)
{
int row = view.addRow ();
view.set (row, 0, command.first);
view.set (row, 1, Command::categoryNames.at (command.second->_category));
view.set (row, 1, Command::categoryNames.at (command.second->category ()));
if (command.second->read_only ())
view.set (row, 2, "RO");
@ -213,7 +213,7 @@ int CmdZshCommands::execute (std::string& output)
std::vector <ZshCommand> commands;
for (auto& command : context.commands)
{
ZshCommand zshCommand {command.second->_category,
ZshCommand zshCommand {command.second->category (),
command.first,
command.second->description ()};
commands.push_back (zshCommand);