function _drush_bootstrap_global_options

6.x bootstrap.inc _drush_bootstrap_global_options()
3.x environment.inc _drush_bootstrap_global_options()
4.x environment.inc _drush_bootstrap_global_options()
5.x bootstrap.inc _drush_bootstrap_global_options()
7 calls to _drush_bootstrap_global_options()
drush_command_set_command_specific in includes/command.inc
drush_main in ./drush.php
The main Drush function.
drush_preflight_command_dispatch in includes/drush.inc
Handle any command preprocessing that may need to be done, including potentially redispatching the command immediately (e.g. for remote commands).
drush_shell_alias_replace in includes/command.inc
_drush_bootstrap_do_drupal_site in includes/bootstrap.inc
Called by _drush_bootstrap_drupal_site to do the main work of the drush drupal site bootstrap.

... See full list

File

includes/bootstrap.inc, line 624
Drush bootstrapping code.

Code

function _drush_bootstrap_global_options() {
  // Debug implies verbose
  drush_set_context('DRUSH_VERBOSE', drush_get_option(array('verbose', 'debug'), FALSE));
  drush_set_context('DRUSH_DEBUG', drush_get_option('debug'));

  // Backend implies affirmative unless negative is explicitly specified
  drush_set_context('DRUSH_NEGATIVE', drush_get_option('no', FALSE));
  drush_set_context('DRUSH_AFFIRMATIVE', drush_get_option(array('yes', 'pipe'), FALSE) || (drush_get_context('DRUSH_BACKEND') && !drush_get_context('DRUSH_NEGATIVE')));
  drush_set_context('DRUSH_SIMULATE', drush_get_option('simulate', FALSE));

  // Suppress colored logging if --nocolor option is explicitly given or if
  // terminal does not support it.
  $nocolor = (drush_get_option('nocolor', FALSE));
  if (!$nocolor) {
    // Check for colorless terminal.  If there is no terminal, then
    // 'tput colors 2>&1' will return "tput: No value for $TERM and no -T specified",
    // which is not numeric and therefore will put us in no-color mode.
    $colors = exec('tput colors 2>&1');
    $nocolor = !($colors === FALSE || (is_numeric($colors) && $colors >= 3));
  }
  drush_set_context('DRUSH_NOCOLOR', $nocolor);
}