@@ -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
+ while (true ) {
104
+ $ availableScaffolds = array_combine (
105
+ array_keys ($ this ->availableScaffolds ()),
106
+ array_map (fn (array $ scaffold ) => $ scaffold ['description ' ], $ this ->availableScaffolds ())
107
+ );
108
+
109
+ $ name = $ io ->choice ('Available scaffolds ' , $ availableScaffolds );
110
+ $ scaffold = $ this ->availableScaffolds ()[$ 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 ($ 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
+ }
107
127
108
- $ input ->setArgument ('name ' , [$ io ->choice ('Available scaffolds ' , $ availableScaffolds )]);
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... ' );
136
+
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