Skip to content

generate

Generate boilerplate code for modules/plugins/services etc.

Drush asks questions so that the generated code is as polished as possible. After generating, Drush lists the files that were created.

Examples

  • drush generate. Pick from available generators and then run it.
  • drush generate controller. Generate a controller class for your module.
  • drush generate drush-command-file. Generate a Drush commandfile for your module.

Arguments

  • [--generator]. A generator name. Omit to pick from available Generators.

Options

  • --answers=ANSWERS. A JSON string containing pairs of question and answers.
  • --directory=DIRECTORY. Absolute path to a base directory for file writing.

Topics

Aliases

  • gen

Legend

  • An argument or option with square brackets is optional.
  • Any default value is listed at end of arg/option description.
  • An ellipsis indicates that an argument accepts multiple values separated by a space.