How do I create a Drush command
Here is how I scaffold a module to be able to run Drush commands.
First, I create the module with Drupal Console: drupal generate:module
Then, I have to create the file drush_services.yml and include this in it:
services:
MY_MODULE.commands:
class: \Drupal\MY_MODULE\Commands\WHATEVERINAMEMYCLASSCommands
tags:
- { name: drush.command }