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()
2 calls to _drush_bootstrap_global_options()
drush_command_default_options in includes/command.inc
Conditionally include default options based on the command used.
_drush_bootstrap_drush in includes/environment.inc
Initial Drush bootstrap phase.

File

includes/environment.inc, line 465
Functions used by drush to query the environment and setting the current configuration.

Code

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


  // Backend implies affirmative
  drush_set_context('DRUSH_AFFIRMATIVE', drush_get_option(array('y', 'yes', 'b', 'backend'), FALSE));
  drush_set_context('DRUSH_NEGATIVE', drush_get_option(array('n', 'no'), FALSE));
  drush_set_context('DRUSH_SIMULATE', drush_get_option(array('s', 'simulate'), FALSE));

  // Suppress colored logging if --nocolor option is explicitly given or if
  // terminal does not support it.
  $nocolor = (drush_get_option(array('nocolor'), FALSE) || !getenv('TERM'));
  if (!$nocolor) {
    // Check for colorless terminal.
    $colors = exec('tput colors 2>&1');
    $nocolor = !($colors === FALSE || (is_numeric($colors) && $colors >= 3));
  }
  drush_set_context('DRUSH_NOCOLOR', $nocolor);
}