Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Overview of the Coding for Drush Series

Parent Feed: 

Drush is one of the coolest tools available for Drupal developers. It provides all sorts of commands for assisting in Drupal development, automating workflows and making it easier to script various parts of the drupal workflow. But sometimes the commands that come with drush or those available from other modules just don’t quite cut it. Sometimes we need to automate things that are specific to our own site. Drush commands can also be really useful for quick one-off data migration tasks and other things for which writing a whole module might just be overkill. In this series we’re going to learn about:

  • What a drush command is and where drush finds the commands that it can use
  • How to use hook_drush_command in order to tell drush that we want to provide new commands
  • How to output data from our commands using some of drush's built-in helper functions.
  • Writing our own custom drush commands
  • Passing arguments to a command
  • Passing options to a command
  • How to prompt the user for input while your command is executing
  • Invoking other drush commands from our own
  • Creating make files

This series assumes that you’re already familiar with the basics of drush, that you’ve got it installed on your system and that you’re comfortable with running drush commands provided by core and contrib modules. If you’re not familiar with drush, you might want to start with the Introduction to Drush Series which covers all of the prerequisites for this series.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web