diff --git a/features.drush.inc b/features.drush.inc index 14a5025..346a7e8 100644 --- a/features.drush.inc +++ b/features.drush.inc @@ -67,6 +67,11 @@ function features_drush_command() { 'drupal dependencies' => array('features'), 'aliases' => array('fr-all', 'fra'), ); + $items['features-conflicts'] = array( + 'description' => "List all of the conflicted features for your site.", + 'drupal dependencies' => array('features'), + 'aliases' => array('fc', 'conflicts'), + ); $items['features-diff'] = array( 'description' => "Show the difference between the default and overridden state of a feature.", 'arguments' => array( @@ -100,6 +105,8 @@ function features_drush_help($section) { return dt("Revert a feature module on your site."); case 'drush:features-diff': return dt("Show a diff of a feature module."); + case 'drush:features-conflict': + return dt("List of the conflicted features for your site."); } } @@ -423,6 +430,30 @@ function drush_features_diff() { } /** + * Get a list of conflicted features. + */ +function drush_features_conflicts() { + module_load_include('inc', 'features', 'features.export'); + $features = features_get_features(); + $conflicts = features_get_conflicts(); + + $rows[] = array( dt('Feature'), dt('Conflict(s)')); + foreach ($features as $name => $module) { + if (!empty($conflicts[$name])) { + $module_conflicts = array(); + foreach (array_keys($conflicts[$name]) as $conflict) { + $module_conflicts[] = $conflict; + } + $rows[] = array( + "{$module->info['name']} ({$module->name})", // Name (machine_name) + implode(', ', $module_conflicts), + ); + } + } + drush_print_table($rows, TRUE); +} + +/** * Helper function to call drush_set_error(). * * @param $feature