resolveCommand() public method

Returns the command to execute for the given console arguments.
public resolveCommand ( Webmozart\Console\Api\Args\RawArgs $args ) : ResolvedCommand
$args Webmozart\Console\Api\Args\RawArgs The console arguments.
return Webmozart\Console\Api\Resolver\ResolvedCommand The command to execute.
Example #1
0
 /**
  * {@inheritdoc}
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     /* @var ArgsInput $input */
     Assert::isInstanceOf($input, 'Webmozart\\Console\\Adapter\\ArgsInput');
     $rawArgs = $input->getRawArgs();
     $resolvedCommand = $this->adaptedApplication->resolveCommand($rawArgs);
     // Add parsed Args to the adapter
     $input = new ArgsInput($rawArgs, $resolvedCommand->getArgs());
     // Don't use $this->get() as get() does not work for sub-commands
     $this->currentCommand = new CommandAdapter($resolvedCommand->getCommand(), $this);
     try {
         $result = parent::doRun($input, $output);
         $this->currentCommand = null;
     } catch (Exception $e) {
         $this->currentCommand = null;
         throw $e;
     }
     return $result;
 }