@@ -62,15 +62,49 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
6262 $ themes = $ this ->themeList ->getAllThemes ();
6363 $ options = array_map (fn ($ theme ) => $ theme ->getCode (), $ themes );
6464
65+ // Ensure proper terminal settings for Laravel Prompts
66+ if (function_exists ('posix_isatty ' ) && !posix_isatty (STDOUT )) {
67+ // Fallback for non-TTY environments
68+ $ this ->displayAvailableThemes ($ this ->io );
69+ return Command::SUCCESS ;
70+ }
71+
72+ // Improve terminal compatibility
73+ putenv ('COLUMNS=80 ' );
74+ putenv ('LINES=30 ' );
75+ putenv ('TERM=xterm-256color ' );
76+
77+ // Force output buffer flush before prompts
78+ if (ob_get_level ()) {
79+ ob_end_flush ();
80+ }
81+
82+ $ this ->io ->newLine ();
83+ $ this ->io ->text ("Available themes: " . implode (', ' , $ options ));
84+ $ this ->io ->newLine ();
85+
6586 $ themeCodesPrompt = new MultiSelectPrompt (
6687 label: 'Select themes to build ' ,
6788 options: $ options ,
68- scroll: 10 ,
69- hint: ' Arrow keys to navigate, Space to select, Enter to confirm ' ,
89+ hint: ' Use arrow keys to navigate, Space to select/deselect, Enter to confirm ' ,
90+ required: false ,
7091 );
7192
72- $ themeCodes = $ themeCodesPrompt ->prompt ();
73- \Laravel \Prompts \Prompt::terminal ()->restoreTty ();
93+ try {
94+ $ themeCodes = $ themeCodesPrompt ->prompt ();
95+ \Laravel \Prompts \Prompt::terminal ()->restoreTty ();
96+
97+ // If no themes selected, show available themes
98+ if (empty ($ themeCodes )) {
99+ $ this ->io ->info ('No themes selected. ' );
100+ return Command::SUCCESS ;
101+ }
102+ } catch (\Exception $ e ) {
103+ // Fallback if prompt fails
104+ $ this ->io ->error ('Interactive mode failed: ' . $ e ->getMessage ());
105+ $ this ->displayAvailableThemes ($ this ->io );
106+ return Command::SUCCESS ;
107+ }
74108 }
75109
76110 return $ this ->processBuildThemes ($ themeCodes , $ this ->io , $ output , $ isVerbose );
0 commit comments