I was scratching my head over why my hook_drush_init() was getting called for core drush commands but not my own, and found this buried in the code docs:
// If command callback function name begins with "drush_$commandfile_",
// then fix up the command entry so that drush_invoke will be
// called by way of drush_command. This will cause all
// of the applicable hook functions to be called for the
// command when it is invoked. If the callback function does
// -not- begin with its commandfile name, then it will be
// called directly by drush_dispatch, and no hook functions
// will be called (e.g. you cannot hook drush_print_file).
This could really do with mentioning in drush.api.php.
Comments
Comment #1
greg.1.anderson commentedThis issue was marked
closed (won't fix)because Drush has moved to Github.If desired, you may copy this bug to our Github project and then post a link here to the new issue. Please also change the status of this issue to
closed (duplicate).Please ask support questions on Drupal Answers.