Drupal Camp LA 2019 - Ashok Modi
{
"name": "org/my_module",
"description": "This extension provides new commands for Drush.",
"type": "drupal-drush",
"authors": [
{
"name": "Author name",
"email": "author@example.com"
}
],
"require": {
"php": ">=5.6.0"
},
"extra": {
"drush": {
"services": {
"drush.services.yml": "^9"
}
}
}
}
services:
swlaw_colleague.commands:
class: \Drupal\swlaw_colleague\Commands\ModuleCommands
tags:
- { name: drush.command }
ModuleCommands will map to whatever you name your file
<?php
namespace Drupal\my_module\Commands
class ModuleCommands extends DrushCommands {
/**
* @command mymodule:command1
* @aliases mym:c1
*/
public function myFirstCommand() {
// ...
}
}