private function parse()
{
$opts = $this->result->options;
$commandName = $this->result->command_name;
$command = null;
$optionSet = $argumentSet = false;
// special treatment for -h --help main command options
if ($opts['help'] === true) {
$commandName = 'help';
}
if ($commandName) {
$configFile = $this->paths['configs'] . 'commands/' . $commandName . '.yml';
$command = new Command($configFile);
}
// check if any option is set
// basically check for --version -v --help -h options
foreach ($opts as $name => $value) {
if ($value === true) {
$optionSet = true;
break;
}
}
// fire up subcommand
if (isset($command['callback'])) {
$this->invoke($command['callback'], $command);
}
if ($commandName === false && $optionSet === false && $argumentSet === false) {
$this->parser->outputter->stdout("Type 'phrozn help' for usage.\n");
}
}