You are here

function drupalmoduleupgrader_drush_command in Drupal 7 to 8/9 Module Upgrader 8

Implements hook_drush_command().

File

./drupalmoduleupgrader.drush.inc, line 15
Declarations for Drush.

Code

function drupalmoduleupgrader_drush_command() {
  $items = [];
  $items['dmu-list'] = [
    'description' => 'Lists available plugins.',
    'arguments' => [
      'plugin_type' => 'The plugin type to query. Can be one of: indexer, analyzer, converter, cleaner.',
    ],
    'required-arguments' => TRUE,
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
  ];
  $items['dmu-index'] = [
    'description' => 'Indexes a target module.',
    'arguments' => [
      'module' => 'The name of a Drupal 7 module.',
    ],
    'required-arguments' => TRUE,
    'examples' => [
      'drush dmu-index pants' => 'Indexes the pants module.',
    ],
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
  ];
  $items['dmu-analyze'] = [
    'description' => "Analyzes a Drupal 7 module and reports the changes needed to port it to Drupal 8.",
    'arguments' => [
      'module' => 'The machine name of a Drupal 7 module.',
    ],
    'required-arguments' => TRUE,
    'options' => [
      'only' => [
        'description' => 'A comma-separated list of analyzers to run, excluding all others.',
        'example-value' => 'HookMenu,VariableAPI,BlockInfo',
      ],
      'skip' => [
        'description' => 'A comma-separated list of analyzers to skip.',
        'example-value' => 'HookInit,HookExit',
      ],
      'path' => [
        'description' => 'Optional path to the target module.',
        'example-value' => 'drupal/modules/foobaz',
      ],
      'output' => [
        'description' => 'Optional path to output the report.',
        'example-value' => 'path/to/module/analyze.html',
      ],
    ],
    'examples' => [
      'drush dmu-analyze pants' => 'Analyze what needs to be changed in order to port the pants module.',
    ],
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
  ];
  $items['dmu-upgrade'] = [
    'description' => "Upgrades a Drupal 7 module to Drupal 8.",
    'arguments' => [
      'module' => 'The machine name of a Drupal 7 module.',
    ],
    'required-arguments' => TRUE,
    'options' => [
      'backup' => [
        'description' => 'If set, creates a backup copy of the module before conversion.',
      ],
      'only' => [
        'description' => 'A comma-separated list of converters to run, excluding all others.',
        'example-value' => 'HookMenu,VariableAPI,BlockInfo',
      ],
      'skip' => [
        'description' => 'A comma-separated list of converters to skip.',
        'example-value' => 'HookInit,HookExit',
      ],
      'path' => [
        'description' => 'Optional path to the target module. Will be determined automatically if omitted.',
        'example-value' => 'drupal/modules/foobaz',
      ],
    ],
    'examples' => [
      'drush dmu-upgrade pants' => 'Upgrade whatever can be automatically upgraded in the pants module.',
    ],
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
  ];
  return $items;
}