1

When you run drush features-revert-all command, it can be altered using hook_drush_command_alter (&$command).

However during run it's invoking another command by:

drush_invoke('features-revert', $features_to_revert);

It seems I can still use drush_hook_pre_COMMAND and drush_hook_post_COMMAND to perform some additional checks.

However I'd like to alter the list of arguments (features) being passed into features-revert which are not available as part of the main command.

Is there any Drush hook which I can use to achieve that?

1

Drush calls command hooks via the function _drush_invoke_hooks, which unfortunately does not provide any facility to alter the arguments list from a pre or validate hook. We are looking to provide a more flexible mechanism that would allow this in Drush 9. Currently, only the command alter hook can change the parameters to a command. Ideally, Drush commands should invoke other Drush commands via drush_invoke_process; this will also go through the command alter hook. If a command uses drush_invoke, though, you are stuck, as drush_invoke bypasses the alter hook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.