44
55use Illuminate \Console \Command ;
66use Illuminate \Filesystem \Filesystem ;
7+
78use function Termwind \render ;
89
910class Configure extends Command
@@ -14,33 +15,37 @@ class Configure extends Command
1415
1516 public function handle (): void
1617 {
17- $ filesystem = new Filesystem () ;
18+ $ filesystem = new Filesystem ;
1819
1920 $ configs = [
2021 'rector.php ' ,
2122 'phpstan.neon ' ,
2223 'pint.json ' ,
2324 ];
2425
26+ render (view ('codebuddy::banner ' ));
27+
2528 foreach ($ configs as $ file ) {
26- $ sourceFile = __DIR__ . "/../../config/laravel/ {$ file }" ;
29+ $ sourceFile = __DIR__ . "/../../config/laravel/ {$ file }" ;
2730 $ destinationFile = base_path ($ file );
2831
29- if (!$ filesystem ->exists ($ sourceFile )) {
32+ if (! $ filesystem ->exists ($ sourceFile )) {
3033 $ this ->error ("Source file not found: {$ sourceFile }" );
34+
3135 continue ;
3236 }
3337
3438 if ($ filesystem ->exists ($ destinationFile )) {
3539 $ overwrite = $ this ->confirmOverwrite ($ destinationFile );
36- if (!$ overwrite ) {
40+ if (! $ overwrite ) {
3741 $ this ->warn ("Skipped: {$ destinationFile } already exists " );
42+
3843 continue ;
3944 }
4045 }
4146
4247 $ filesystem ->copy ($ sourceFile , $ destinationFile );
43- $ this ->info ("Copied : {$ file } to project root " );
48+ $ this ->info ("Created : {$ file } in project root " );
4449 $ this ->newLine ();
4550 }
4651 }
@@ -51,6 +56,6 @@ private function confirmOverwrite(string $file): bool
5156 sprintf ('%s already exists. Do you want to overwrite it? ' , $ file )
5257 );
5358
54- return $ this ->ask ('Overwrite? ' , false );
59+ return $ this ->confirm ('Overwrite? ' , true );
5560 }
5661}
0 commit comments