I'm trying to add extra option to the existing command as below:

 * Implements hook_drush_command_alter().
function MYMODULE_drush_command_alter(&$command) {
  if ($command['command'] == 'features-revert-all') {
    $command['options']['cleanup'] = dt("Remove non-existing components from the database after revert.");

However it seems it doesn't work as expected and drush fra --cleanup fails.

Then the help command doesn't show this option either.

What's the proper way of adding such option, so drush can understand it and can be available for further parsing via drush_get_option?


This is done with drush_help_alter rather than drush_command_alter. See the example Drush policy file, reproduced in part below:

function policy_drush_help_alter(&$command) {
  if ($command['command'] == 'updatedb') {
    $command['options']['token'] = 'Per site policy, you must specify a token in the --token option for all commands.';
| improve this answer | |

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.