Adding components to a feature via Drush
Pergunta
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.
Solução
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.
Outras dicas
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
.
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"