Since: 1.0
Author: Bernhard Schussek (bschussek@gmail.com)
Inheritance: extends AbstractHelp
コード例 #1
0
ファイル: HelpTextHandler.php プロジェクト: webmozart/console
 /**
  * {@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;
 }
コード例 #2
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());
    }