diff --git a/commands/core/cache.drush.inc b/commands/core/cache.drush.inc index b48d1734c9..0bc10a1d6a 100644 --- a/commands/core/cache.drush.inc +++ b/commands/core/cache.drush.inc @@ -23,6 +23,7 @@ function cache_drush_command() { 'outputformat' => array( 'default' => 'print-r', 'pipe-format' => 'var_export', + 'output-data-type' => TRUE, ), 'aliases' => array('cg'), ); diff --git a/commands/core/config.drush.inc b/commands/core/config.drush.inc index 7876d492ab..d53f09b5cb 100644 --- a/commands/core/config.drush.inc +++ b/commands/core/config.drush.inc @@ -46,6 +46,7 @@ function config_drush_command() { 'outputformat' => array( 'default' => 'yaml', 'pipe-format' => 'var_export', + 'output-data-type' => TRUE, ), 'aliases' => array('cget'), 'core' => array('8+'), diff --git a/commands/core/outputformat.drush.inc b/commands/core/outputformat.drush.inc index 1d4f97b8a0..8b0f5c910a 100644 --- a/commands/core/outputformat.drush.inc +++ b/commands/core/outputformat.drush.inc @@ -275,7 +275,7 @@ function outputformat_drush_help_alter(&$command) { // If the command does not define specific field labels, // then hide the help for --fields unless the command // works with output format engines that format tables. - if (isset($outputformat['require-engine-capability'])) { + if (isset($outputformat['require-engine-capability']) && is_array($outputformat['require-engine-capability'])) { if (!in_array('format-table', $outputformat['require-engine-capability'])) { unset($command['options']['fields']); } @@ -355,10 +355,10 @@ class drush_outputformat { return ($this->formatter_type() == 'list') && ($this->sub_engine->supports_single_only()); } function data_type($metadata) { - if (isset($metadata['metameta']['require-engine-capability'])) { + if (isset($metadata['metameta']['require-engine-capability']) && is_array($metadata['metameta']['require-engine-capability'])) { return $metadata['metameta']['require-engine-capability'][0]; } - if (isset($metadata['require-engine-capability'])) { + if (isset($metadata['require-engine-capability']) && is_array($metadata['require-engine-capability'])) { return $metadata['require-engine-capability'][0]; } return 'unspecified'; diff --git a/includes/engines.inc b/includes/engines.inc index 9b4e8990bf..27e6c0ca46 100644 --- a/includes/engines.inc +++ b/includes/engines.inc @@ -162,8 +162,8 @@ function drush_merge_engine_data(&$command) { unset($config[$engine_option_alias_name]); } } - // Make sure that 'require-engine-capability' is always an array. - if (isset($config['require-engine-capability']) && !is_array($config['require-engine-capability'])) { + // Convert single string values of 'require-engine-capability' to an array. + if (isset($config['require-engine-capability']) && is_string($config['require-engine-capability'])) { $config['require-engine-capability'] = array($config['require-engine-capability']); } $command['engines'][$engine_type] = $config; @@ -239,10 +239,15 @@ function drush_merge_engine_data(&$command) { // it is assumed that the engine can satisfy all requirements. if (array_key_exists('engine-capabilities', $data)) { $engine_is_usable = FALSE; - foreach ($config['require-engine-capability'] as $required) { - // We need an engine that provides any one of the requirements. - if (in_array($required, $data['engine-capabilities'])) { - $engine_is_usable = TRUE; + // If 'require-engine-capability' is TRUE instead of an array, + // then only engines that are universal (do not declare any + // particular capabilities) are usable. + if (is_array($config['require-engine-capability'])) { + foreach ($config['require-engine-capability'] as $required) { + // We need an engine that provides any one of the requirements. + if (in_array($required, $data['engine-capabilities'])) { + $engine_is_usable = TRUE; + } } } } @@ -254,7 +259,7 @@ function drush_merge_engine_data(&$command) { $engine_data['options'][$option]['description'] = array_key_exists('description', $data) ? $data['description'] : NULL; if ($combine_help) { $engine_data['options'][$option]['hidden'] = TRUE; - if (drush_get_context('DRUSH_VERBOSE') || !isset($data['verbose-only'])) { + if (drush_get_context('DRUSH_VERBOSE') || ($default == $engine) || !isset($data['verbose-only'])) { $combine_help_data[$engine] = $engine . ': ' . $data['description']; } }