@@ -27,8 +27,8 @@ protected function configure()
2727 ->addArgument ('name ' , InputArgument::OPTIONAL )
2828 ->addOption ('dev ' , null , InputOption::VALUE_NONE , 'Installs the latest "development" release ' )
2929 ->addOption ('jet ' , null , InputOption::VALUE_NONE , 'Installs the Laravel Jetstream scaffolding ' )
30- ->addOption ('stack ' , null , InputOption::VALUE_OPTIONAL , 'The Jetstream stack ' )
31- ->addOption ('teams ' , null , InputOption::VALUE_OPTIONAL , 'Install Jetstream teams ' )
30+ ->addOption ('stack ' , null , InputOption::VALUE_OPTIONAL , 'The Jetstream stack that should be installed ' )
31+ ->addOption ('teams ' , null , InputOption::VALUE_NONE , 'Indicates whether Jetstream should be scaffolded with team support ' )
3232 ->addOption ('force ' , 'f ' , InputOption::VALUE_NONE , 'Forces install even if the directory already exists ' );
3333 }
3434
@@ -50,9 +50,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
5050
5151 $ stack = $ this ->jetstreamStack ($ input , $ output );
5252
53- $ teams = ! is_null ( $ input ->getOption ('teams ' ))
54- ? (bool ) $ input ->getOption ('teams ' )
55- : (new SymfonyStyle ($ input , $ output ))->confirm ('Will your application use teams? ' , false );
53+ $ teams = $ input ->getOption ('teams ' ) === true
54+ ? (bool ) $ input ->getOption ('teams ' )
55+ : (new SymfonyStyle ($ input , $ output ))->confirm ('Will your application use teams? ' , false );
5656 } else {
5757 $ output ->write (PHP_EOL .'<fg=red> _ _
5858| | | |
@@ -141,6 +141,33 @@ protected function installJetstream(string $directory, string $stack, bool $team
141141 $ this ->runCommands ($ commands , $ input , $ output );
142142 }
143143
144+ /**
145+ * Determine the stack for Jetstream.
146+ *
147+ * @param \Symfony\Component\Console\Input\InputInterface $input
148+ * @param \Symfony\Component\Console\Output\OutputInterface $output
149+ * @return string
150+ */
151+ protected function jetstreamStack (InputInterface $ input , OutputInterface $ output )
152+ {
153+ $ stacks = [
154+ 'livewire ' ,
155+ 'inertia ' ,
156+ ];
157+
158+ if ($ input ->getOption ('stack ' ) && in_array ($ input ->getOption ('stack ' ), $ stacks )) {
159+ return $ input ->getOption ('stack ' );
160+ }
161+
162+ $ helper = $ this ->getHelper ('question ' );
163+
164+ $ question = new ChoiceQuestion ('Which Jetstream stack do you prefer? ' , $ stacks );
165+
166+ $ output ->write (PHP_EOL );
167+
168+ return $ helper ->ask ($ input , new SymfonyStyle ($ input , $ output ), $ question );
169+ }
170+
144171 /**
145172 * Verify that the application does not already exist.
146173 *
@@ -239,31 +266,4 @@ protected function replaceInFile(string $search, string $replace, string $file)
239266 str_replace ($ search , $ replace , file_get_contents ($ file ))
240267 );
241268 }
242-
243- /**
244- * Determine the stack for Jetstream.
245- *
246- * @param \Symfony\Component\Console\Input\InputInterface $input
247- * @param \Symfony\Component\Console\Output\OutputInterface $output
248- * @return string
249- */
250- protected function jetstreamStack (InputInterface $ input , OutputInterface $ output )
251- {
252- $ stacks = [
253- 'livewire ' ,
254- 'inertia ' ,
255- ];
256-
257- if ($ input ->getOption ('stack ' ) && in_array ($ input ->getOption ('stack ' ), $ stacks )) {
258- return $ input ->getOption ('stack ' );
259- }
260-
261- $ helper = $ this ->getHelper ('question ' );
262-
263- $ question = new ChoiceQuestion ('Which Jetstream stack do you prefer? ' , $ stacks );
264-
265- $ output ->write (PHP_EOL );
266-
267- return $ helper ->ask ($ input , new SymfonyStyle ($ input , $ output ), $ question );
268- }
269269}
0 commit comments