From 9af44c21328148e6581692d965de63abb0c32908 Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Tue, 7 Nov 2017 09:58:19 -0500 Subject: [PATCH] Fix #3145. Link to DI docs from command authoring. --- docs/commands.md | 3 ++- docs/dependency-injection.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/commands.md b/docs/commands.md index f3c9705916..0ce39dbfe6 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -7,7 +7,8 @@ Creating a new Drush command or porting a legacy command is easy. Follow the ste 1. Drush will prompt for the machine name of the module that should "own" the file. 1. (optional) Drush will also prompt for the path to a legacy command file to port. See [tips on porting command to Drush 9](https://weitzman.github.io/blog/port-to-drush9) 1. Drush will then report that it created a commandfile and a drush.services.yml file. Edit those 2 files as needed. -1. Use the classes for the core Drush commands at /src/Drupal/Commands as inspiration and documentation. +1. Use the classes for the core Drush commands at /src/Drupal/Commands as inspiration and documentation. +1. See the [dependency injection docs](dependency-injection.md) for interfaces you can implement to gain access to Drush config, Drupal site aliases, etc. 1. Once your two files are ready, run `drush cr` to get your command recognized by the Drupal container. Global Drush Commands diff --git a/docs/dependency-injection.md b/docs/dependency-injection.md index 9caaecc26f..46c0cc2b86 100644 --- a/docs/dependency-injection.md +++ b/docs/dependency-injection.md @@ -66,7 +66,7 @@ All Drush command files extend DrushCommands; DrushCommands implements IOAwareIn Any additional services that are desired must be injected by implementing the appropriate inflection interface. -Available Drush Services +Available Interfaces: - AutoloaderAwareInterface: Provides access to the class loader. - SiteAliasManagerAwareInterface: The site alias manager [allows alias records to be obtained](site-alias-manager.md).