@@ -100,12 +100,47 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
100
100
return ;
101
101
}
102
102
103
- $ availableScaffolds = array_combine (
104
- array_keys ($ this ->availableScaffolds ()),
105
- array_map (fn (array $ scaffold ) => $ scaffold ['description ' ], $ this ->availableScaffolds ())
106
- );
103
+ $ scaffolds = $ this ->availableScaffolds ();
104
+
105
+ while (true ) {
106
+ $ name = $ io ->choice ('Available scaffolds ' , array_combine (
107
+ array_keys ($ scaffolds ),
108
+ array_map (fn (array $ scaffold ) => $ scaffold ['description ' ], $ scaffolds )
109
+ ));
110
+ $ scaffold = $ scaffolds [$ name ];
111
+
112
+ $ io ->title ($ name );
113
+ $ io ->text ($ scaffold ['description ' ]);
114
+ $ io ->newLine ();
115
+
116
+ if ($ scaffold ['dependents ' ] ?? []) {
117
+ $ io ->text ('This scaffold will also install the following scaffolds: ' );
118
+ $ io ->newLine ();
119
+ $ io ->listing (\array_map (fn ($ s ) => \sprintf ('%s - %s ' , $ s , $ scaffolds [$ s ]['description ' ]), $ scaffold ['dependents ' ]));
120
+ }
121
+
122
+ if ($ scaffold ['packages ' ] ?? []) {
123
+ $ io ->text ('This scaffold will install the following composer packages: ' );
124
+ $ io ->newLine ();
125
+ $ io ->listing (\array_keys ($ scaffold ['packages ' ]));
126
+ }
127
+
128
+ if ($ scaffold ['js_packages ' ] ?? []) {
129
+ $ io ->text ('This scaffold will install the following node packages: ' );
130
+ $ io ->newLine ();
131
+ $ io ->listing (\array_keys ($ scaffold ['js_packages ' ]));
132
+ }
133
+
134
+ if (!$ io ->confirm ("Would your like to create the \"{$ name }\" scaffold? " )) {
135
+ $ io ->text ('Going back to main menu... ' );
107
136
108
- $ input ->setArgument ('name ' , [$ io ->choice ('Available scaffolds ' , $ availableScaffolds )]);
137
+ continue ;
138
+ }
139
+
140
+ $ input ->setArgument ('name ' , [$ name ]);
141
+
142
+ return ;
143
+ }
109
144
}
110
145
111
146
private function generateScaffold (string $ name , ConsoleStyle $ io ): void
0 commit comments