/** * Gets the default commands that should always be available. * * @return Command[] An array of default Command instances */ protected function getDefaultCommands() { $list = new ListCommand(); $list->setName('helpList'); $this->setDefaultCommand('helpList'); return [new HelpCommand(), $list]; }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $output->writeln(['', '<comment><info>Zend Framework</info> console commands</comment>', '']); /* @var $moduleManager ModuleManager */ $moduleManager = $this->serviceLocator->getServiceLocator()->get('ModuleManager'); $console = $this->serviceLocator->getServiceLocator()->get('ConsoleAdapter'); $help = array(); foreach ($moduleManager->getLoadedModules() as $module) { $parts = explode('\\', get_class($module)); $modName = array_shift($parts); if (is_callable([$module, 'getConsoleUsage'])) { $usage = $module->getConsoleUsage($console); if (is_array($usage)) { $max = 0; foreach ($usage as $command => $description) { if (is_array($description) || is_numeric($command)) { continue; } if (strlen($command) > $max) { $max = strlen($command); } $help[$command] = $description; } } } } foreach ($help as $command => $description) { $format = sprintf(' <info>%s</info> %s', str_pad($command, $max + 3, ' '), $description); $output->writeln($format); } }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $this->addProtectionWarningToOutput($output); }
protected function execute(InputInterface $input, OutputInterface $output) { $this->checkVersions($output); parent::execute($input, $output); }