Generators jump start your coding by building all the boring boilerplate code for you. After running a
drush generate [foo] command, you have a guide for where to insert your custom logic.
Writing Custom Generators
Drupal modules may supply their own Generators, just like they can supply Commands.
See Woot module, which Drush uses for testing. Specifically,
- Write a class similar to ExampleGenerator. Implement your custom logic in the interact() method. Typically this class is placed in the src/Generators directory.
- Add your class to your module's drush.services.yml file (example). Use the tag
- Perform a
drush cache-rebuildto compile your drush.services.yml changes into the Drupal container.