You are here

function drush_features_components in Features 7.2

Same name and namespace in other branches
  1. 8.4 drush/features.drush8.inc \drush_features_components()
  2. 8.3 drush/features.drush8.inc \drush_features_components()
  3. 7 features.drush.inc \drush_features_components()

Drush command callback for 'features-components'.

Shows a list of exportable items, filtered by component or by pattern. If the item is already exported to a feature, that feature name is shown along with it.

File

./features.drush.inc, line 300
Features module drush integration.

Code

function drush_features_components() {
  $args = func_get_args();
  $components = _drush_features_component_list();
  ksort($components);

  // If no args supplied, prompt with a list.
  if (empty($args)) {
    $types = array_keys($components);
    array_unshift($types, 'all');
    $choice = drush_choice($types, 'Enter a number to choose which component type to list.');
    if ($choice === FALSE) {
      return;
    }
    $args = $choice == 0 ? array(
      '*',
    ) : array(
      $types[$choice],
    );
  }
  $options = array(
    'provided by' => TRUE,
  );
  if (drush_get_option(array(
    'exported',
    'e',
  ), NULL)) {
    $options['not exported'] = FALSE;
  }
  elseif (drush_get_option(array(
    'not-exported',
    'o',
  ), NULL)) {
    $options['exported'] = FALSE;
  }
  if (drush_get_option(array(
    'info-style',
    'is',
  ), NULL)) {
    $options['info style'] = TRUE;
  }
  $filtered_components = _drush_features_component_filter($components, $args, $options);
  if ($filtered_components) {
    _drush_features_component_print($filtered_components, $options);
  }
}