6

For example I would like to see all the commands provided by the features module, I know I can do

drush help | grep features 

But I don't feel safe doing this with all modules present there (you never know when you miss a command). And it often looses important "second lines" such as the shortcut for features-revert-all.
Do you know any command / technique to make sure you get it all safely?

11

You can use the --filter feature of Drush. For example, you can use drush --filter=features to get all the commands available from the Features module, or drush --filter=views to get all the Drush commands available from the Views module.

You could then also pipe that output into a file if you wanted (e.g. drush --filter=views > views_drush_commands.txt).

You can find the docs on the Drush homepage.

  • FYI drush.ws is down at the moment, but if you type drush help help then you should get exactly what's on the site :) – Chapabu Nov 27 '12 at 16:49
  • thanks ! i am runnig the 6.x version from git and at the moment it only shows the filtered commands after all of the rest, but its still good enough :) – mojzis Nov 27 '12 at 17:04
  • 1
    after git pull and upgrading PHP it works exactly as advertised, great :) – mojzis Nov 27 '12 at 17:25
  • Handy! Also, drushcommands.com is nice too, though incomplete. – cdmo Nov 9 '15 at 21:31
  • I can't found the --filter option, in wich version of drush this exist? – Adrian Cid Almaguer Jun 22 '16 at 15:14
2

If the module have less than 4 commands you can't use the drush --filter=MODULE_NAME because you will obtain the following message:

[error]  The specified command category onlyone does not exist. 

In this case you can use drush --filter and select the number that correspond with Other commands (usually at the end of the list).

You can read more about this behavior in: How to integrate the drush help --filter option with your custom module?

  • --filter Doesn't work in Drupal 8 – Achraf JEDAY Jan 24 '19 at 11:52
  • @AchrafJEDAY I have Drupal 8.6.6 and Drush 9.4.0 and is working, I think you need to write an issue in the Drush project page. – Adrian Cid Almaguer Jan 24 '19 at 15:33
  • it say "The "--filter" option requires a value." when used without a value (I have drush 9.5.2 and the latest drupal 8) – Achraf JEDAY Jan 24 '19 at 22:35
  • @AchrafJEDAY yes you need to use a module name. – Adrian Cid Almaguer Jan 25 '19 at 15:40

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.