You are here

function drush_features_components in Features 8.4

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

Lists components, with pattern matching.

File

drush/features.drush8.inc, line 436
Features module drush integration.

Code

function drush_features_components() {
  $args = func_get_args();
  _drush_features_options();
  $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 ? [
      '*',
    ] : [
      $types[$choice],
    ];
  }
  $options = [
    'provided by' => TRUE,
  ];
  if (drush_get_option([
    'exported',
    'e',
  ], NULL)) {
    $options['not exported'] = FALSE;
  }
  elseif (drush_get_option([
    '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);
  }
}