You are here

function drush_features_components in Features 7

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.2 features.drush.inc \drush_features_components()

List components, with pattern matching.

File

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

Code

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

  // 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;
  }
  $filtered_components = _drush_features_component_filter($components, $args, $options);
  if ($filtered_components) {
    _drush_features_component_print($filtered_components);
  }
}