_drush_bootstrap_global_options
- drupal
Drupal 7 _drush_bootstrap_global_options()
7 calls to _drush_bootstrap_global_options()
File
- sites/
all/ modules/ drush/ includes/ bootstrap.inc, line 619 - 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);
}

