I'm working on a Drupal 6.x site using features version 6.1, I was trying to get the list of the available components using drush features-component, but I noticed it is not available in this version.
Is this command supported in features 6.x at all?
Is there another way of getting the components list?

CommentFileSizeAuthor
#1 drush-fc.patch8.74 KBfxarte

Comments

fxarte’s picture

StatusFileSize
new8.74 KB

I've been using the modifications in this patch without any issues on a Drupal 6.22 site.
As you can see is a verbatim port from 7.x.

ryan.ryan’s picture

Bless you... bless you. :D

UTAN_dev’s picture

I also need the fc command, but I'm having trouble working around a patch problem.

I'm using Features 6.x-1.2+19- and features.drush.inc already has a declaration for function _drush_features_component_list. After I apply the patch, Drush complains that _drush_features_component_list is redefined. Here are the two functions in features.drush.inc after patching:

function _drush_features_component_list() {
  $components = array();
  foreach (features_get_feature_components() as $source => $info) {
    if ($options = features_invoke($source, 'features_export_options')) {
      foreach ($options as $name => $title) {
        $components[$source][$name] = $title;
      }
    }
  }
  return $components;
}
function _drush_features_component_list($arg = NULL, $source = NULL, $render = TRUE) {
  static $items;

  $index = empty($source) ? 'all' : $source;
  $index .= ':';
  $index .= empty($arg) ? 'all' : $arg;

  if (empty($items[$index])) {
    $components = features_get_components(TRUE);
    if ($arg) {
      $heading = dt('Components similar to "!arg"', array('!arg' => $arg));
    }
    else {
      $heading = dt('Available components');
    }
    if ($source) {
      $heading .= ' ' . dt('in category "!source"', array('!source' => $source));
      if (array_key_exists($source, $components)) {
        $components = array($source => $components[$source]);
      }
      else {
        return FALSE;
      }
    }

    $rows = array(array($heading));
    foreach ($components as $component => $info) {
      if ($options = features_invoke($component, 'features_export_options')) {
        foreach ($options as $key => $value) {
          if (empty($arg) || strpos($key, $arg) !== FALSE) {
            $rows[$component .':'. $key] = array($component .':'. $key);
          }
        }
      }
    }
    $items[$index] = $rows;
  }
  if ($render) {
    drush_print_table(array_values($items[$index]), TRUE);
    return array_keys($items[$index]);
  }
  return array_slice(array_keys($items[$index]), 1);
}

Which declaration should I keep? Thanks for your help.

osopolar’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Issue summary: View changes
Status: Active » Closed (works as designed)

There seems to be no need for this anymore, as in latest dev you can use drush features-add {fature-name} without providing a component to list all components.

I think marking this as "works as designed" should be okay for Drupal 6, if not, feel free to reopen the issue.