Skip to content

Commit

Permalink
fix project-directory option
Browse files Browse the repository at this point in the history
  • Loading branch information
ol0lll committed Aug 26, 2024
1 parent 1291a80 commit ba8d688
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 50 deletions.
38 changes: 4 additions & 34 deletions BackendCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ public function updateDatabase()
/**
* Add option to command.
*
* @hook option config:export
* @hook option backend:create-testing-dump backend:install config:export config:import
*
* @param \Symfony\Component\Console\Command\Command $command
* @param \Consolidation\AnnotatedCommand\AnnotationData $annotationData
*/
public function additionalConfigExportOption(Command $command, AnnotationData $annotationData)
public function additionalBackendOptions(Command $command, AnnotationData $annotationData)
{
$command->addOption(
'project-directory',
Expand All @@ -143,12 +143,12 @@ public function additionalConfigExportOption(Command $command, AnnotationData $a
}

/**
* @hook init config:export
* @hook init backend:create-testing-dump backend:install config:export config:import
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Consolidation\AnnotatedCommand\AnnotationData $annotationData
*/
public function initConfigExportCommand(InputInterface $input, AnnotationData $annotationData)
public function initBackendCommands(InputInterface $input, AnnotationData $annotationData)
{
$this->initCommands($input, $annotationData);
}
Expand Down Expand Up @@ -233,36 +233,6 @@ public function preConfigImportCommand(CommandData $commandData)
$this->populateConfigSyncDirectory();
}

/**
* Add option to command.
*
* @hook option config:import
*
* @param \Symfony\Component\Console\Command\Command $command
* @param \Consolidation\AnnotatedCommand\AnnotationData $annotationData
*/
public function additionalConfigImportOption(Command $command, AnnotationData $annotationData)
{
$command->addOption(
'project-directory',
'',
InputOption::VALUE_NONE,
'The base directory of the project. Defaults to composer root of project. Option added by burdastyle backend commands.'
);
}

/**
* @hook init config:import
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Consolidation\AnnotatedCommand\AnnotationData $annotationData
*/
public function initConfigImportCommand(InputInterface $input, AnnotationData $annotationData)
{
$this->initCommands($input, $annotationData);
}


/**
* Prepare an update branch. Does code update, database update and config export.
*
Expand Down
18 changes: 2 additions & 16 deletions BackendCommandsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
namespace Drush\Commands\BurdaStyleGroup;

use Consolidation\AnnotatedCommand\AnnotationData;
use Consolidation\AnnotatedCommand\CommandError;
use Consolidation\SiteAlias\SiteAliasInterface;
use Consolidation\SiteAlias\SiteAliasManagerAwareTrait;
use Drupal\Core\Site\Settings;
use Drush\Drush;
use Symfony\Component\Console\Input\InputInterface;
use Webmozart\PathUtil\Path;
use Symfony\Component\Filesystem\Path;

/**
* Trait for backend drush commands.
Expand Down Expand Up @@ -38,7 +37,7 @@ trait BackendCommandsTrait
private $projectDirectory;

/**
* @hook init
* Init params.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Consolidation\AnnotatedCommand\AnnotationData $annotationData
Expand All @@ -49,19 +48,6 @@ public function initCommands(InputInterface $input, AnnotationData $annotationDa
$this->projectDirectory = $input->getOption('project-directory') ?: Drush::bootstrapManager()->getComposerRoot();
}

/**
* Define default options for most backend commands.
*
* @hook option @options-backend
*
* @option project-directory The base directory of the project. Defaults to composer root of project.
*
* @param array $options
*/
public function optionsBackend($options = ['project-directory' => false])
{
}

/**
* Drush command wrapper.
*
Expand Down

0 comments on commit ba8d688

Please sign in to comment.