1515
1616use CodeIgniter \CLI \AbstractCommand ;
1717use CodeIgniter \CLI \Attributes \Command ;
18- use CodeIgniter \CLI \CLI ;
1918use CodeIgniter \CLI \Input \Option ;
2019
2120/**
@@ -49,10 +48,11 @@ protected function configure(): void
4948
5049 protected function execute (array $ arguments , array $ options ): int
5150 {
52- $ force = $ options ['force ' ] === true ;
51+ $ force = $ options ['force ' ] === true ;
52+ $ output = $ this ->getOutput ();
5353
54- CLI :: write ('Setting up FrankenPHP Worker Mode ' , 'yellow ' );
55- CLI :: newLine ();
54+ $ output -> write ('Setting up FrankenPHP Worker Mode ' , 'yellow ' );
55+ $ output -> newLine ();
5656
5757 helper ('filesystem ' );
5858
@@ -71,36 +71,36 @@ protected function execute(array $arguments, array $options): int
7171 $ content = file_get_contents ($ source );
7272
7373 if ($ content === false ) {
74- CLI :: error (sprintf ('Failed to read template: %s ' , $ template ), 'light_gray ' , 'red ' );
74+ $ output -> error (sprintf ('Failed to read template: %s ' , $ template ), 'light_gray ' , 'red ' );
7575
7676 return EXIT_ERROR ;
7777 }
7878
7979 if (! write_file ($ target , $ content )) {
80- CLI :: error (sprintf ('Failed to create file: %s ' , clean_path ($ target )), 'light_gray ' , 'red ' );
80+ $ output -> error (sprintf ('Failed to create file: %s ' , clean_path ($ target )), 'light_gray ' , 'red ' );
8181
8282 return EXIT_ERROR ;
8383 }
8484
8585 if ($ force && $ isFile ) {
86- CLI :: write (sprintf (' File overwritten: %s ' , clean_path ($ target )), 'yellow ' );
86+ $ output -> write (sprintf (' File overwritten: %s ' , clean_path ($ target )), 'yellow ' );
8787 } else {
88- CLI :: write (sprintf (' File created: %s ' , clean_path ($ target )), 'green ' );
88+ $ output -> write (sprintf (' File created: %s ' , clean_path ($ target )), 'green ' );
8989 }
9090
9191 $ created [] = $ destination ;
9292 }
9393
9494 if ($ created === []) {
95- CLI :: write ('Worker mode files already exist. ' , 'yellow ' );
96- CLI :: write ('Use --force to overwrite existing files. ' , 'yellow ' );
95+ $ output -> write ('Worker mode files already exist. ' , 'yellow ' );
96+ $ output -> write ('Use --force to overwrite existing files. ' , 'yellow ' );
9797
9898 return EXIT_ERROR ;
9999 }
100100
101- CLI :: newLine ();
102- CLI :: write ('Worker mode files created successfully! ' , 'green ' );
103- CLI :: newLine ();
101+ $ output -> newLine ();
102+ $ output -> write ('Worker mode files created successfully! ' , 'green ' );
103+ $ output -> newLine ();
104104
105105 $ this ->showNextSteps ();
106106
@@ -109,14 +109,16 @@ protected function execute(array $arguments, array $options): int
109109
110110 private function showNextSteps (): void
111111 {
112- CLI ::write ('Next Steps: ' , 'yellow ' );
113- CLI ::newLine ();
112+ $ output = $ this ->getOutput ();
114113
115- CLI ::write ('1. Start FrankenPHP: ' , 'white ' );
116- CLI ::write (' frankenphp run ' , 'green ' );
117- CLI ::newLine ();
114+ $ output ->write ('Next Steps: ' , 'yellow ' );
115+ $ output ->newLine ();
118116
119- CLI ::write ('2. Test your application: ' , 'white ' );
120- CLI ::write (' curl http://localhost:8080/ ' , 'green ' );
117+ $ output ->write ('1. Start FrankenPHP: ' , 'white ' );
118+ $ output ->write (' frankenphp run ' , 'green ' );
119+ $ output ->newLine ();
120+
121+ $ output ->write ('2. Test your application: ' , 'white ' );
122+ $ output ->write (' curl http://localhost:8080/ ' , 'green ' );
121123 }
122124}
0 commit comments