function _drush_preflight_global_options

8.0.x _drush_preflight_global_options()
7.x _drush_preflight_global_options()
master _drush_preflight_global_options()
8 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/
drush_early_complete in includes/
Produce autocomplete output.
drush_preflight in includes/
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…

... See full list


includes/, line 587
Preflight, postflight and shutdown code.


function _drush_preflight_global_options() {
  // Debug implies verbose
  $verbose = drush_get_option('verbose', FALSE);
  $debug = drush_get_option('debug', FALSE);
  drush_set_context('DRUSH_VERBOSE', $verbose || $debug);
  drush_set_context('DRUSH_DEBUG', $debug);
  drush_set_context('DRUSH_DEBUG_NOTIFY', $verbose && $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);

  // Copy the simulated option to the Robo configuration object.
  // TODO: Long-term there should be a better way to do this (e.g. via an event listener)
  $config = \Drush::service('config');

  // Copy the output verbosity into the output object
  $verbosity = OutputInterface::VERBOSITY_NORMAL;
  if (drush_get_context('DRUSH_VERBOSE')) {
    $verbosity = OutputInterface::VERBOSITY_VERBOSE;
  if (drush_get_context('DRUSH_DEBUG')) {
    $verbosity = OutputInterface::VERBOSITY_DEBUG;
  $output = \Drush::service('output');