<?php

/**
 * @file
 * Drush integration for {{ name }} module.
 */

/**
 * Implements hook_drush_command().
 */
function {{ machine_name }}_drush_command() {
  $items['{{ machine_name }}-list'] = [
    'description' => 'Show a list of available {{ name|plural|lower }}.',
  ];
  return $items;
}

/**
 * Callback function for {{ machine_name }}-list command.
 */
function drush_{{ machine_name }}_list() {
  $plugin_manager = Drupal::service('plugin.manager.{{ machine_name }}');

  $rows[] = [
    'ID',
    'Label',
    'Description',
    'Method 1',
    'Method 2',
    'Method 3',
  ];

  foreach ($plugin_manager->getDefinitions() as $definition) {
    ${{ machine_name }} = $plugin_manager->createInstance($definition['id']);
    $rows[] = [
      $definition['id'],
      $definition['label'],
      $definition['description'],
      ${{ machine_name }}->method1(),
      ${{ machine_name }}->method2(),
      ${{ machine_name }}->method3(),
    ];
  }

  drush_print_table($rows);
}
