Updates to Drush Chapter for Drush-5 Release


  • U1
  • With the release of Drush-5RC2, some of the details presented in the Drush chapter of the Definitive Guide to Drupal 7 must be updated. This page does not attempt to cover the new features of Drush-5; only things that are now different than their description in the chapter are covered. Fortunately, Drush-5 adds a lot of new documentation which you can view via `drush topic`. Whenever you download a new version of Drush, always consult `drush help` and `drush topic` to find the new capabilities and helpful information that has been added since the last release.

    Here is a list of things that have changed.

    drush cache-clear:

    Drush now has its own cache which can be cleared via `drush cache-clear drush`. The Drush cache is used to speed up command dispatching by storing the location of all of the Drush command files. Drush will automatically clear this cache when you download new modules via pm-download, but if you are writing your own commands, you may need to clear this cache before Drush will be able to find newly-created commandfiles.

    drush core-cli:

    The core-cli command has been removed in Drush-5. This command was very popular with some Drush users, but not to worry; the capabilities of core-cli are still available, but in a different form. Look for the instructions in drush.complete.sh and examples/example.bashrc for instructions on how to add autocomplation and a number of very useful bash aliases to your standard bash shell.


    In Drush-5, drush_invoke_process now has a different parameter list than it did in Drush-4. Most of the other routines that had a similar function were removed from Drush-5. There is a table showing how to convert from the old Drush-4 routines to drush_invoke_process in Drush 5 at http://www.drush.org/drush-4-to-drush-5.

    'options' are no longer optional:

    In Drush-4, it was optional to list the options that your Drush command takes. In Drush-5, Drush will print out an error message if the user tries to use an option that is not listed in the command record. It is therefore even more important to completely document your commands. The error can be bypassed by adding --invoke to the command line. Commands that allow "extra" options not listed in their help text to be used may do so by adding 'allow-additional-options' to its command record. See also 'strict-option-handling' below for another way for Drush-5 commands to handle "extra" options.

    Strict option handling:

    In Drush-5, some commands use 'strict option handling'. Sometimes you will need to adjust the location where you place Drush global options on the command line; for example, the Drush command drush core-rsync @live @dev --include-conf --simulate in DGD7 must be re-ordered to drush --simulate core-rsync @live @dev --include-conf. Read drush topic docs-strict-options for information about these commands.

    $options['include'][] = '...' and $options['config'][] = '...':

    In Drush-5, it is possible to specify multiple 'include' and 'config' options by using php array syntax.

  • Author(s)

  • Greg Anderson