Beispiel #1
0
 /**
  * Attempt to complete the current word as a command argument value
  *
  * @see Symfony\Component\Console\Input\InputArgument
  * @return array|false
  */
 protected function completeForCommandArguments()
 {
     if (strpos($this->context->getCurrentWord(), '-') !== 0) {
         if ($this->command) {
             $argWords = $this->mapArgumentsToWords($this->command->getNativeDefinition()->getArguments());
             $wordIndex = $this->context->getWordIndex();
             if (isset($argWords[$wordIndex])) {
                 $name = $argWords[$wordIndex];
                 if ($helper = $this->getCompletionHelper($name, Completion::TYPE_ARGUMENT)) {
                     return $helper->run();
                 }
                 if ($this->command instanceof CompletionAwareInterface) {
                     return $this->command->completeArgumentValues($name, $this->context);
                 }
             }
         }
     }
     return false;
 }
 /**
  * Attempt to complete the current word as a command argument value
  *
  * @see Symfony\Component\Console\Input\InputArgument
  * @return array|false
  */
 protected function completeForCommandArguments()
 {
     if (!$this->command || strpos($this->context->getCurrentWord(), '-') === 0) {
         return false;
     }
     $definition = $this->command->getNativeDefinition();
     $argWords = $this->mapArgumentsToWords($definition->getArguments());
     $wordIndex = $this->context->getWordIndex();
     if (isset($argWords[$wordIndex])) {
         $name = $argWords[$wordIndex];
     } elseif (!empty($argWords) && $definition->getArgument(end($argWords))->isArray()) {
         $name = end($argWords);
     } else {
         return false;
     }
     if ($helper = $this->getCompletionHelper($name, Completion::TYPE_ARGUMENT)) {
         return $helper->run();
     }
     if ($this->command instanceof CompletionAwareInterface) {
         return $this->command->completeArgumentValues($name, $this->context);
     }
     return false;
 }