File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 20
20
use Cake \Core \Exception \Exception ;
21
21
use Cake \Core \Plugin ;
22
22
use Cake \Utility \Inflector ;
23
+ use Cake \Shell \Task \CommandTask ;
23
24
24
25
/**
25
26
* Shell dispatcher handles dispatching cli commands.
@@ -185,15 +186,33 @@ protected function _dispatch() {
185
186
* For all loaded plugins, add a short alias
186
187
*
187
188
* This permits a plugin which implements a shell of the same name to be accessed
188
- * Using the plugin name alone
189
+ * Using the shell name alone
189
190
*
190
191
* @return void
191
192
*/
192
193
public function addShortPluginAliases () {
193
194
$ plugins = Plugin::loaded ();
194
195
196
+ $ task = new CommandTask ();
197
+ $ list = $ task ->getShellList ();
198
+ $ fixed = array_flip ($ list ['app ' ]) + array_flip ($ list ['CORE ' ]);
199
+ $ aliases = [];
200
+
195
201
foreach ($ plugins as $ plugin ) {
196
- self ::alias ($ plugin , "$ plugin. $ plugin " );
202
+ if (!isset ($ list [$ plugin ])) {
203
+ continue ;
204
+ }
205
+
206
+ foreach ($ list [$ plugin ] as $ shell ) {
207
+ $ aliases += [$ shell => $ plugin ];
208
+ }
209
+ }
210
+
211
+ foreach ($ aliases as $ shell => $ plugin ) {
212
+ if (isset ($ fixed [$ shell ])) {
213
+ continue ;
214
+ }
215
+ static ::alias ($ shell , "$ plugin. $ shell " );
197
216
}
198
217
}
199
218
You can’t perform that action at this time.
0 commit comments