You can use the drush help --filter
command to present a list of
command categories to view. When you run the command: drush --filter=devel_generate
you can see the following output:
All commands in devel_generate: (devel_generate)
generate-content Create content.
(genc)
generate-menus Create menus and menu items.
(genm)
generate-terms Create terms in specified vocabulary.
(gent)
generate-users Create users.
(genu)
generate-vocabs Create vocabularies.
(genv)
You can read in the Drush Command page:
help
Options: --filter=[category] Restrict command list to those commands defined in the specified file. Omit value to choose from a list of names.
I create the onlyone.drush.inc file with the following code:
<?php
/**
* @file
* Drush commands related to OnlyOne.
*/
/**
* Implements hook_drush_command().
*/
function onlyone_drush_command() {
$items['onlyone-list'] = array(
'description' => dt("List the configured content types to have Only One node."),
'aliases' => array('ol'),
'examples' => array(
'drush onlyone-list' => dt("List the configured content types to have Only One node."),
),
);
return $items;
}
/**
* Callback for the onlyone-list command.
*/
function drush_onlyone_list() {
$onlyone_content_types = variable_get('onlyone_node_types');
if (count($onlyone_content_types)) {
drush_print(dt("Content types configured to have only one node:"));
drush_print(implode("\n", $onlyone_content_types));
}
else {
drush_print(dt("There is not content types configured to have only one node."));
}
}
I clean the cache with drush cc drush
but when I use drush help --filter=onlyone
I get this output:
[error] The specified command category onlyone does not exist.
So, how can I obtain the list of the commands defined in my module?