public function add_command(PS_CLI_Command $command, $handler) { $interface = PS_CLI_INTERFACE::getInterface(); if (is_object($handler)) { $this->_cli->command($command->name); $this->_cli->description($command->description); foreach ($command->getOpts() as $opt => $fields) { $this->_cli->opt($opt, $fields['description'], $fields['required'], $fields['type']); } foreach ($command->getArgs() as $arg => $fields) { $this->_cli->arg($arg, $fields['description'], $fields['required']); } //keep track of who handles what $this->_commands[$command->name] = $handler; return true; } else { $interface->add_warning("Could not add command {$command}\n"); return false; } }