#include "shell.h" namespace mshconsole { Shell::Commands::Commands(Shell* s) : commands(), threadCommands() { parent = s; } void Shell::Commands::add(Command* cmd, bool isthread){ if(!isthread) commands.push_back(cmd); else threadCommands.push_back(cmd); } size_t Shell::Commands::howMany() const{ return commands.size(); } int Shell::Commands::launch(const struct Params& p, bool launchThread){ for(unsigned int i=0; i<(launchThread ? threadCommands.size() : commands.size()); i++){ if((launchThread ? threadCommands[i]->getName() : commands[i]->getName())==p.argv[0]){ return (launchThread ? threadCommands[i]->execute(p, parent) : commands[i]->execute(p, parent)); } } throw CommandNotFoundException(); } }