Esempio n. 1
0
 function it_runs_help_for_command(IInput $input, IOutput $output, IConsole $console)
 {
     $input->hasOption('--help')->willReturn(true);
     $input->getArgument('args')->willReturn(['name']);
     $console->parseString('help name')->shouldBeCalled();
     $this->run($input, $output, $console);
 }
Esempio n. 2
0
 /**
  * @param IInput $input
  * @param IConsole $console
  *
  * @return ICommand
  * @throws AmbiguousCommandException
  * @throws CommandNotFoundException
  */
 protected function findCommand(IInput $input, IConsole $console)
 {
     if ($input->hasArgument('command')) {
         $matcher = new ArgumentsMatcher(new ArgumentsParser());
         return $matcher->findCommand($console->getCommands(), $input->getArgument('command'));
     }
     return $input->getCommand();
 }
Esempio n. 3
0
 /**
  * @param IInput $input
  * @param IOutput $output
  * @param IConsole $console
  *
  * @return bool
  */
 public function run(IInput $input, IOutput $output, IConsole $console)
 {
     if ($input->hasOption('--help')) {
         $args = $input->getArgument('args');
         $subject = array_shift($args);
         $console->parseString("help {$subject}");
         return false;
     }
 }
Esempio n. 4
0
 function it_runs(IInput $input, IConsole $console)
 {
     $console->getCommands()->willReturn([new Command('test')]);
     $input->hasArgument('command')->willReturn(true);
     $input->getArgument('command')->willReturn('test');
     $output = new Output();
     $output->setEnableBuffering(true);
     $this->run($input, $output, $console);
 }
 /**
  * @param IInput $input
  * @param IOutput $output
  * @param IConfig $config
  */
 public function run(IInput $input, IOutput $output, IConfig $config)
 {
     $this->input = $input;
     $this->output = $output;
     $config = $config->toArray();
     $search = $input->getArgument('search');
     $config = array_dot($config);
     ksort($config);
     if ($search !== null) {
         $config = $this->findConfig($config, $search);
     }
     $this->output->writeLine(" <header>Config:</header>");
     if (count($config)) {
         $this->renderConfig($config);
     } else {
         $output->writeLineIndented('No configuration found');
     }
 }