/**
  * @dataProvider generateHookDataProvider
  */
 public function testZshSyntax($programPath, $programName, $multiple)
 {
     if ($this->hasProgram('zsh')) {
         $script = $this->factory->generateHook('zsh', $programPath, $programName, $multiple);
         $this->assertSyntaxIsValid($script, 'zsh -n', 'ZSH hook');
     } else {
         $this->markTestSkipped("Couldn't detect ZSH program to run hook syntax check");
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->handler = new CompletionHandler($this->getApplication());
     $handler = $this->handler;
     if ($input->getOption('generate-hook')) {
         global $argv;
         $program = $argv[0];
         $factory = new HookFactory();
         $hook = $factory->generateHook($input->getOption('shell-type') ?: $this->getShellType(), $program, $input->getOption('program'));
         $output->write($hook, true);
     } else {
         $handler->setContext(new EnvironmentCompletionContext());
         $output->write($this->runCompletion(), true);
     }
 }
Beispiel #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->handler = new CompletionHandler($this->getApplication());
     $handler = $this->handler;
     if ($input->getOption('generate-hook')) {
         global $argv;
         $program = $argv[0];
         $factory = new HookFactory();
         $alias = $input->getOption('program');
         $multiple = (bool) $input->getOption('multiple');
         // When completing for multiple apps having absolute path in the alias doesn't make sense.
         if (!$alias && $multiple) {
             $alias = basename($program);
         }
         $hook = $factory->generateHook($input->getOption('shell-type') ?: $this->getShellType(), $program, $alias, $multiple);
         $output->write($hook, true);
     } else {
         $handler->setContext(new EnvironmentCompletionContext());
         $output->write($this->runCompletion(), true);
     }
 }