I understand using 'drush fu' to look for changes to any components of an existing feature, but is there a way to add a component to an existing feature using drush? Right now I have to use the /admin tools to recreate, download the files, upload, etc. Would be nice if there was a way to do this process via drush.
4 Answers
Update: there is a direct way to add components via Drush.
First, to list components drush fc
(for features components) will list out all exportable components, including which, if any, feature they are currently exported to.
Next, drush fe foo_feature variable:foo_var views_view:foo_view
will update, or create, a module named foo_feature
. The output from drush fc
can be used to populate the required component:name
syntax.
Original answer
While there is no direct command, the quickest way to add components is by editing the .info
file.
For example, to add a view foo_view
, you would add this line:
features[views][] = "foo_view"
or, to add a variable that hadn't been added, you would add this line:
features[variable][] = "my_variable"
Once these have been added to the .info
file, you can then run drush fu
, and the additional components will be exported with your feature.
Update:
There is a command. See the below answer about the drush fe
command.
-
This doesn't seem to work with user permission and drush 5.– gagarineCommented Aug 5, 2012 at 21:37
-
Thanks for your answer! I was unable to load the re-create page in the UI for one of my site's features, and the only way to update it or add new components is via drush fc / drush fu—and it's way faster besides, which is a win in my book. Commented Jul 11, 2013 at 14:15
-
does anyone have a drush command or anything to change the fc format to info file format ? BTW the " arent needed afaik– mojzisCommented Apr 23, 2014 at 8:56
There's been an on-going discussion about this topic, but it seems that drush features-export (drush fe) is the accepted solution.
To find the components (views, pages, etc.) you want to add to your feature, use drush features-components
; this command has a relatively easy-to-use interface that should be familiar to anyone who has created Features through the admin graphical interface.
Once you've found the component you want, enter it in the pattern drush fe [feature_name] [component_name]
, as in the following:
drush fe feature_name views_view:user_questions
HISTORICAL INFO (deprecated)
Drush formerly used drush features-add
for this functionality; the maintainers seem to have settled upon drush features-export
.
-
-
Just to note that features add is deprecated. Use features-export instead.– forestCommented Sep 26, 2012 at 13:35
drush features-add is deprecated. Use drush features-export instead. It will add components to existing features as well.
To get a list of exportable components first use
drush features-components --not-exported [pattern]
See drush features-components --help for how to use [pattern] to filter the components to be listed.
It's worth noting that quotes are required for permissions that have spaces in them. For example drush fe fcc_user_config user_permission:"edit own content_type content"