public function getOptionConfigs() { $options = $this->options; $plugins = PluginManager::getPluginList(); if (is_array($this->metaDoc) && isset($this->metaDoc['options'])) { $rawOptions = $this->metaDoc['options']; } else { $rawOptions = array(); } foreach ($plugins as $plugin) { $pluginItem = PluginManager::getPluginObject($plugin); $pluginOptions = $pluginItem->getCommandOptions($this->classname); $rawOptions = array_merge_recursive($rawOptions, $pluginOptions); } foreach ($rawOptions as $metaOption) { // See if it allows input if (isset($metaOption['input']) && $metaOption['input'] === true) { // Defaults to optional if not set. if (isset($metaOption['required']) && $metaOption['required'] === true) { $mode = InputOption::VALUE_REQUIRED; } else { $mode = InputOption::VALUE_OPTIONAL; } // Defaults to single value if (isset($metaOption['array']) && $metaOption['array'] === true) { $mode = $mode | InputOption::VALUE_IS_ARRAY; } } else { $mode = InputOption::VALUE_NONE; } $options[] = array($metaOption['name'], isset($metaOption['shortcut']) ? $metaOption['shortcut'] : null, $mode, isset($metaOption['description']) ? $metaOption['description'] : '', isset($metaOption['default']) ? $metaOption['default'] : null); } return $options; }
protected function outputPluginListing(InputInterface $input, OutputInterface $output, $list = null) { if (is_null($list)) { $list = PluginManager::getPluginList(); } $table = new Table($output); $table->setHeaders(array('Plugin', 'Description')); foreach ($list as $plugin) { $plugin = PluginManager::getPluginObject($plugin); $config = $plugin->getDescription(); $row = array($config['name'], isset($config['description']) ? $config['description'] : null); $table->addRow($row); } $table->render(); }