- Implemented the ability to iterate over installed Command objects,
  to augment the '_commands' command.
- Renamed verbosity tokens, to de-pluralize them.
This commit is contained in:
Paul Beckingham 2011-05-14 15:45:52 -04:00
parent 14bea5e1b4
commit 902ed48243
8 changed files with 49 additions and 52 deletions

View file

@ -119,9 +119,9 @@ void Context::initialize2 (int argc, char** argv)
// TODO Load relevant rc file.
// Instantiate built-in command objects.
commands.push_back (Command::factory ("exec"));
commands.push_back (Command::factory ("install"));
commands.push_back (Command::factory ("_logo"));
commands["exec"] = Command::factory ("exec");
commands["install"] = Command::factory ("install");
commands["logo"] = Command::factory ("_logo");
// TODO Instantiate extension command objects.
// TODO Instantiate default command object.
@ -248,15 +248,15 @@ int Context::dispatch2 (std::string &out)
updateXtermTitle ();
std::vector <Command*>::iterator c;
std::map <std::string, Command*>::iterator c;
for (c = commands.begin (); c != commands.end (); ++c)
{
if ((*c)->implements (commandLine))
if (c->second->implements (commandLine))
{
if (! (*c)->read_only ())
if (! c->second->read_only ())
tdb.gc ();
return (*c)->execute (commandLine, out);
return c->second->execute (commandLine, out);
}
}