drush icon indicating copy to clipboard operation
drush copied to clipboard

Add an inflection for bootstrapManager

Open joachim-n opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

There are a lot of Drush commands that do Drush::bootstrapManager().

Describe the solution you'd like

This could be adapted to the inflection DI pattern, so:

  • a BootstrapManagerAwareInterface
  • a BootstrapManagerAwareTrait

code becomes: $this->bootstrapManager()

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

joachim-n avatar Jan 06 '22 22:01 joachim-n

Very few commands need this, so not sure an inflection is warranted.

weitzman avatar Jan 11 '22 16:01 weitzman

A quick grep got me this:

src/Commands/pm/SecurityUpdateCommands.php
src/Commands/core/MkCommands.php
src/Commands/core/CacheCommands.php
src/Commands/core/EditCommands.php
src/Commands/core/SiteInstallCommands.php
src/Commands/core/SiteCommands.php
src/Commands/core/RunserverCommands.php
src/Commands/core/LoginCommands.php
src/Commands/core/StatusCommands.php
src/Commands/generate/ApplicationFactory.php
src/Commands/core/BrowseCommands.php
src/Commands/generate/Generators/Drush/DrushAliasFile.php
src/Commands/help/ListCommands.php
src/Commands/sql/SqlCommands.php

I don't know what you consider as 'few' ;)

It's also useful for custom commands, as AFAICT the BootstrapManager is the right way to get the app root -- eg https://github.com/joachim-n/automultisites/blob/main/Drush/Commands/SitesDrushCommands.php#L28

joachim-n avatar Jan 11 '22 16:01 joachim-n

Thats more than I expected. Ping @greg-1-anderson for input.

weitzman avatar Jan 11 '22 16:01 weitzman