You are here

protected function Command::options in Config Importer and Tools 8

Same name and namespace in other branches
  1. 8.2 src/Drush/Command.php \Drupal\config_import\Drush\Command::options()
  2. 8.0 src/Drush/Command.php \Drupal\config_import\Drush\Command::options()

Filter the options list for specific command.

1 call to Command::options()
Command::__construct in src/Drush/Command.php
Command constructor.

File

src/Drush/Command.php, line 61

Class

Command
Class Command.

Namespace

Drupal\config_import\Drush

Code

protected function options() {
  $this->info += [
    __FUNCTION__ => [],
  ];

  // A list of all possible options for any command of "config_import" group.
  // Execute the "drush help --filter=config_import" to see them all.
  $options = [
    'type' => [
      'example-value' => 'menu',
      'description' => dt('Config type.'),
    ],
    'name' => [
      'example-value' => 'main',
      'description' => dt('Config name.'),
    ],
    'destination' => [
      'example-value' => 'sites/default/config/prod',
      'description' => dt('Destination path to put configuration file to. Name of configuration folder can be used as well.'),
    ],
  ];
  foreach ($this->info[__FUNCTION__] as $option => $is_required) {

    // Add an option to the command if it's specified.
    if (isset($options[$option])) {
      $this->info[__FUNCTION__][$option] = $options[$option] + [
        'required' => $is_required,
      ];
    }
  }
}