/** * {@inheritdoc} */ public function handle(Args $args, IO $io, Command $command) { $application = $command->getApplication(); if ($args->isArgumentSet('command')) { $theCommand = $application->getCommand($args->getArgument('command')); $usage = new CommandHelp($theCommand); } else { $usage = new ApplicationHelp($application); } $usage->render($io); return 0; }
public function testRenderDescription() { $config = ApplicationConfig::create()->setHelp('The help'); $application = new ConsoleApplication($config); $help = new ApplicationHelp($application); $help->render($this->io); $expected = <<<'EOF' Console Tool USAGE console <command> [<arg1>] ... [<argN>] ARGUMENTS <command> The command to execute <arg> The arguments of the command DESCRIPTION The help EOF; $this->assertSame($expected, $this->io->fetchOutput()); }