Ejemplo n.º 1
0
        }
    }
    if (count($possible_matches) == 1) {
        $subcommand = $possible_matches[0];
    } else {
        $subcommand = NULL;
    }
}
if ($app_options->has('help') || !$subcommand && !$possible_matches) {
    echo "moosh version " . MOOSH_VERSION . "\n";
    echo "No command provided, possible commands:\n\t";
    echo implode("\n\t", array_keys($subcommands));
    echo "\n";
    echo "Global options:\n";
    //$appspecs->printOptions();
    $printer = new GetOptionKit\OptionPrinter\ConsoleOptionPrinter();
    echo $printer->render($appspecs);
    echo "\n";
    exit(1);
}
if (!$subcommand && $possible_matches) {
    foreach ($possible_matches as $match) {
        echo $match . "\n";
    }
    exit(1);
}
$parser->setSpecs($subcommand_specs[$subcommand]);
try {
    $subcommand_options[$subcommand] = $parser->continueParse();
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
Ejemplo n.º 2
0
 public function printOptions()
 {
     echo '*** ' . $this->getName() . " ***\n";
     echo "OPTIONS:\n";
     $printer = new \GetOptionKit\OptionPrinter\ConsoleOptionPrinter();
     echo $printer->render($this->spec);
     echo $this->getArgumentsHelp();
     echo "\n";
 }