Skip to content

Commit c1db3c3

Browse files
committed
Let users pick which containers must get installed by default
1 parent 44e8fe0 commit c1db3c3

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

commands/NewCommand.php

+34-1
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,43 @@ protected function execute(InputInterface $input, OutputInterface $output)
8989
if ($input->getOption('git')/* || $input->getOption('github') !== false*/) {
9090
$this->createRepository($directory, $input, $output);
9191
}
92+
}
93+
94+
$helper = $this->getHelper('question');
95+
96+
$confirmation = new ConfirmationQuestion('Now do you want to add additional containers? [default: no] ', false);
97+
98+
$availableContainers = [
99+
'Social Authentication' => 'apiato/social-auth-container',
100+
'Localization' => 'apiato/localization-container',
101+
'Payments' => 'apiato/payment-container',
102+
'Settings' => 'apiato/settings-container',
103+
];
104+
105+
if ($helper->ask($input, $output, $confirmation)) {
106+
$question = new ChoiceQuestion(
107+
'Select all containers you want to install (example: 2,3,4).',
108+
array_keys($availableContainers)
109+
);
92110

93-
$output->writeln(PHP_EOL . '<comment>Apiato ready! Build something amazing.</comment>');
111+
$question->setMultiselect(true);
112+
113+
$selectedContainersArray = $helper->ask($input, $output, $question);
114+
$selectedContainersString = "";
115+
$commands = ['cd ' . $directory];
116+
117+
foreach (array_keys($availableContainers) as $availableContainer) {
118+
if (in_array($availableContainer, $selectedContainersArray)) {
119+
$selectedContainersString .= ' ' . $availableContainers[$availableContainer];
120+
}
121+
}
122+
123+
array_push($commands, $composer . " require" . $selectedContainersString);
124+
$this->runCommands($commands, $input, $output);
94125
}
95126

127+
$output->writeln(PHP_EOL . '<comment>Apiato ready! Build something amazing.</comment>');
128+
96129
return $process->getExitCode();
97130
}
98131

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy