diff --git a/src/Drush/Commands/GenerateEnvironmentDrushCommands.php b/src/Drush/Commands/GenerateEnvironmentDrushCommands.php index b1b5337..b02db34 100644 --- a/src/Drush/Commands/GenerateEnvironmentDrushCommands.php +++ b/src/Drush/Commands/GenerateEnvironmentDrushCommands.php @@ -4,8 +4,6 @@ use Drupal\Component\Serialization\Json; use DrupalCodeGenerator\Asset\AssetCollection; -use DrupalCodeGenerator\Validator\Chained; -use DrupalCodeGenerator\Validator\Required; use Drush\Attributes as CLI; /** @@ -148,24 +146,20 @@ protected function interview(array &$vars): void { if (!isset($vars['build_mode'])) { $composerData = Json::decode(file_get_contents($this->drupalFinder()->getComposerRoot() . '/composer.json')); $defaultValue = $composerData['extra']['combawa']['build_mode'] ?? 'install'; - $choices = ['install', 'update']; - $choice = $this->io()->choice( + $vars['build_mode'] = $this->io()->select( 'What is your current build mode?', - $choices, + ['install', 'update'], $defaultValue, ); - $vars['build_mode'] = $choices[$choice] ?? $choice; } if (!isset($vars['environment'])) { $defaultValue = $_ENV['COMBAWA_BUILD_ENV'] ?? 'prod'; - $choices = ['dev', 'testing', 'prod']; - $choice = $this->io()->choice( + $vars['environment'] = $this->io()->select( 'Which kind of environment is it?', - $choices, + ['dev', 'testing', 'prod'], $defaultValue, ); - $vars['environment'] = $choices[$choice] ?? $choice; } if (!isset($vars['webroot'])) { @@ -255,13 +249,11 @@ protected function interview(array &$vars): void { if (!isset($vars['dump_fetch_method'])) { $defaultValue = $_ENV['COMBAWA_DB_RETRIEVAL_TOOL'] ?? 'scp'; - $choices = ['cp', 'scp']; - $choice = $this->io()->choice( + $vars['dump_fetch_method'] = $this->io()->select( 'When updated, what is the tool used to retrieve the reference dump?', - $choices, + ['cp', 'scp'], $defaultValue, ); - $vars['dump_fetch_method'] = $choices[$choice] ?? $choice; } if ($vars['dump_fetch_method'] === 'scp') { diff --git a/src/Drush/Commands/InitializeBuildScriptsDrushCommands.php b/src/Drush/Commands/InitializeBuildScriptsDrushCommands.php index 3887211..1263e48 100644 --- a/src/Drush/Commands/InitializeBuildScriptsDrushCommands.php +++ b/src/Drush/Commands/InitializeBuildScriptsDrushCommands.php @@ -66,13 +66,11 @@ protected function interview(array &$vars): void { if (!isset($vars['build_mode'])) { $composerData = Json::decode(file_get_contents($this->drupalFinder()->getComposerRoot() . '/composer.json')); $defaultValue = $composerData['extra']['combawa']['build_mode'] ?? 'install'; - $choices = ['install', 'update']; - $choice = $this->io()->choice( + $vars['build_mode'] = $this->io()->select( 'What is the build mode to use?', - $choices, + ['install', 'update'], $defaultValue, ); - $vars['build_mode'] = $choices[$choice] ?? $choice; } $scriptsDir = $this->drupalFinder()->getComposerRoot() . '/scripts/combawa';