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?

2 Answers 2

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.

5
  • 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, 2012 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, 2012 at 17:04
  • 1
    after git pull and upgrading PHP it works exactly as advertised, great :)
    – mojzis
    Nov 27, 2012 at 17:25
  • Handy! Also, drushcommands.com is nice too, though incomplete.
    – cdmo
    Nov 9, 2015 at 21:31
  • I can't found the --filter option, in wich version of drush this exist? Jun 22, 2016 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?

4
  • --filter Doesn't work in Drupal 8 Jan 24, 2019 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. Jan 24, 2019 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) Jan 24, 2019 at 22:35
  • @AchrafJEDAY yes you need to use a module name. Jan 25, 2019 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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