We have a large feature that we want to break apart. I am following the instructions here, and since there are a number of objects in the feature, I want to use drush commands, instead of clicking around the UI, to export the different objects.

I am looking at the drush commands from the features 7.x-2.10 module and found features-export. I'm not sure how to use the drush help command, but I found this description in `features.drush.inc`:

case 'drush:features-export':
  return dt("Export a feature from your site into a module. 
   If called with no arguments, display a list of available components.
  ...

But I called it with no arguments, and instead of a list of components, I got this error message:

$> drush features-export
No feature name given.  

Poking around more, I found the features-components command, which gives me this:

$> drush features-components
Enter a number to choose which component type to list.
 [0]   :  Cancel
 [1]   :  all
 [2]   :  breakpoints
 ...
 [11]  :  field_base
 [12]  :  field_group
 [13]  :  field_instance

Selecting 11 (field_base) gives me these tokens:

...
field_base:field_address_1
field_base:field_address_2
field_base:field_state
field_base:field_zip_code
...  

So I thought that I could use a line or token from the above output in the features-export command. However, I still get errors:

$> drush features-export field_instance
No components supplied.                            [error]

$> drush features-export 11
No components supplied.                            [error]

$> drush features-export field_base:field_address_1
No components supplied.                            [error]

$> drush features-export "field_base:field_address_1"
No components supplied.                            [error]

How do I use the features-export command from the features 7.x-2.10 module?

Comments

slefevre1 created an issue. See original summary.

slefevre1’s picture

Issue summary: View changes
slefevre1’s picture

I figured out the syntax.

First, you have to learn the name of the component. Use the features-components command for this.

Then, when you know the component, do drush features-export my_module_name 'component_type:component_name'. That will create a module with the component you specified in it.

So in my case, I would do drush features-export my_module_name 'field_base:field_address_1.

If you want to add multiple components, you have add them to an existing, _enabled_module. So if I want to add another component to the features module I just created, I would do

$> drush en -y my_module_name
$> drush features-export -y my_module_name 'field_base:field_address_2