I saw the interesting answer to the question about "How can I get a list of content types with drush?", which starts like so:
You can create a drush command named
content-type-list
.
But I wonder what it should look like if the command should be named something else, eg mijn-contenttypes-lijst
(instead of content-type-list
), and use drush drush mcl
(instead of drush ctl
)?
Some reasons why I may want to use another name:
- Because it conflicts with something else in Drupal for which I already used
content-type-list
and/orctl
. - The command is hard to remember (eg because it's not in my native language), so I want to adapt it to another name.
What exactly would I have to change in the code included in that answer, which currently looks like so:
<?php
/**
* @file
* Drush commands related to Content Types.
*/
/**
* Implements hook_drush_command().
*/
function drush_content_types_drush_command() {
$items['content-type-list'] = array(
'description' => dt("Show a list of available content types."),
'aliases' => array('ctl'),
);
return $items;
}
/**
* Callback for the content-type-list command.
*/
function drush_drush_content_types_content_type_list() {
$content_types = array_keys(node_type_get_types());
sort($content_types);
drush_print(dt("Machine name"));
drush_print(implode("\r\n", $content_types));
}
PS: I understand I can create aliases for it also (as shown in the linked answer), but that's not what my question is about. E.g. if I want a command that does something different.