function annotationcommand_adapter_process_command

master annotationcommand_adapter.inc annotationcommand_adapter_process_command()

This function is set as the $command['callback'] for commands that have been converted to annotated commands. When the DRUSH_SYMFONY environment variable is set, these will be called via Symfony's Application::run() method. Otherwise, the legacy Drush command dispatcher will be used for all commands.

Return value

bolean false if command failed (expect drush_set_error was called in this case)

1 string reference to 'annotationcommand_adapter_process_command'
annotationcommand_adapter_get_commands_for_commandhandler in includes/annotationcommand_adapter.inc
Convert an annotated command command handler object into a Drush $command record.

File

includes/annotationcommand_adapter.inc, line 197
annotationcommand_adapter.inc

Code

function annotationcommand_adapter_process_command() {
  $userArgs = func_get_args();
  $commandprocessor = annotationcommand_adapter_get_processor();
  $command = drush_get_command();
  annotationcommand_adapter_add_hook_options($command);
  $args =[];
  foreach ($command['consolidation-arg-defaults'] as $key => $default) {
    $value = array_shift($userArgs);
    if (!isset($value)) {
      $value = $default;
    }
    $args[$key] = $value;
  }

  $input = new DrushInputAdapter($args, annotationcommand_adapter_get_options($command), $command['command']);
  $output = new DrushOutputAdapter();
  $annotationData = $command['annotations'];
  $commandData = new CommandData($annotationData, $input, $output);
  $commandData->setIncludeOptionsInArgs($command['add-options-to-arguments']);
  $names = annotationcommand_adapter_command_names($command);

  // n.b.: backend result is set by a post-alter hook.
  $result = $commandprocessor->process($output, $names, $command['annotated-command-callback'], $commandData);

  return $result;
}