3

I am trying to write a shortened Drush option - we want to have an option for both --force as well as -f

I'm searching everywhere and not seeing any documentation, but it seems like something like it is supported based on this page:

https://groups.drupal.org/drush/commands

What I've got so far:

function parsexml_drush_command() {

  $items['parsexml'] = array(
    'description' => 'Parses XML from an XML feed.',
    'aliases' => array('pxml'),
    'arguments' => array(
      'path' => 'Path to the XML file.',
    ),
    'options' => array(
      'force' => 'Flag to force processing of previously processed XML files.',
      'f' => 'Shortened flag to force processing of previously processed XML files.',
    ),
  );

  return $items;
}

But my guess is that that isn't correct.

What is the correct way to have multiple aliases per option? I can only find how to set the alias for a given drush command.

1

Sorry, Drush reserves all short (-f) options for use exclusively by Drush core. You cannot define them in contrib extensions.

See the function drush_get_global_options for an example of how to define options that have attributes; the short option is 'short-form', although this does not work right for non-Core 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.