function _drush_preflight_global_options

8.0.x preflight.inc _drush_preflight_global_options()
7.x preflight.inc _drush_preflight_global_options()
master preflight.inc _drush_preflight_global_options()
7 calls to _drush_preflight_global_options()
DrupalBoot::bootstrap_do_drupal_site in lib/Drush/Boot/DrupalBoot.php
Called by bootstrap_drupal_site to do the main work of the drush drupal site bootstrap.
DrupalBoot::bootstrap_drupal_root in lib/Drush/Boot/DrupalBoot.php
Bootstrap Drush with a valid Drupal Directory.
drush_command_set_command_specific in includes/command.inc
drush_preflight in includes/preflight.inc
During the initialization of Drush, this is the first step where we load our configuration and commandfiles, and select the site we are going to operate on; however, we take no irreversible actions (e.g. site bootstrapping). This allows commands that…
drush_preflight_command_dispatch in includes/preflight.inc
Handle any command preprocessing that may need to be done, including potentially redispatching the command immediately (e.g. for remote commands).

... See full list

File

includes/preflight.inc, line 348
Preflight, postflight and shutdown code.

Code

function _drush_preflight_global_options() {
  // Debug implies verbose
  drush_set_context('DRUSH_VERBOSE', drush_get_option(array('verbose', LogLevel::DEBUG), FALSE));
  drush_set_context('DRUSH_DEBUG', drush_get_option(LogLevel::DEBUG));
  drush_set_context('DRUSH_SIMULATE', drush_get_option('simulate', FALSE));

  // 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')));

  // Pipe implies quiet.
  drush_set_context('DRUSH_QUIET', drush_get_option(array('quiet', 'pipe')));
  drush_set_context('DRUSH_PIPE', drush_get_option('pipe'));

  // 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);
}