How to find where Drush is installed to include a file in my module? I have installed the module Drush Help to see the module's Drush commands in the module help page. But when I go to see the help page of a module that use in the drush commands drush constants like DRUSH_BOOTSTRAP_DRUPAL_FULL I got a Notice because this constant is only defined in drush, and not for Drupal.

You can see this problem if you install the Drush Help and the Node Revision Delete modules (the Drupal 7 version): Visit admin/help/node_revision_delete and you will see this notice message.


  Notice: Use of undefined constant DRUSH_BOOTSTRAP_DRUPAL_FULL - assumed 'DRUSH_BOOTSTRAP_DRUPAL_FULL' in node_revision_delete_drush_command() 


So the problem is that Drupal can't reach the file includes/bootstrap.inc where the constant is defined. I can include the file but the problem is that I need to know where Drush is installed.

How to find where Drush is installed to include a file in my module?
A temporary solution that I found is define the same constants in the drush_help.module file.

/**
 * Constants defined by drush in the includes/bootstrap.inc file.
 *
 * To see why we need to do this please read:
 * https://drupal.stackexchange.com/q/250786/28275
 */
define('DRUSH_BOOTSTRAP_NONE', -1);
define('DRUSH_BOOTSTRAP_MAX', -2);
define('DRUSH_BOOTSTRAP_DRUSH', 0);
define('DRUSH_BOOTSTRAP_DRUPAL_ROOT', 1);
define('DRUSH_BOOTSTRAP_DRUPAL_SITE', 2);
define('DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION', 3);
define('DRUSH_BOOTSTRAP_DRUPAL_DATABASE', 4);
define('DRUSH_BOOTSTRAP_DRUPAL_FULL', 5);
define('DRUSH_BOOTSTRAP_DRUPAL_LOGIN', 6);