|
|
@@ -49,35 +49,11 @@ class CommandScanner
|
|
|
'',
|
|
|
['command_list']
|
|
|
);
|
|
|
- $coreCommands = $this->inflectCommandNames($coreCommands);
|
|
|
|
|
|
return array_merge($coreShells, $coreCommands);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Inflect multi-word command names based on conventions
|
|
|
- *
|
|
|
- * @param array $commands The array of command metadata to mutate
|
|
|
- * @return array The updated command metadata
|
|
|
- * @see \Cake\Console\CommandScanner::scanDir()
|
|
|
- */
|
|
|
- protected function inflectCommandNames(array $commands): array
|
|
|
- {
|
|
|
- foreach ($commands as $i => $command) {
|
|
|
- $file = basename($command['file'], '.php');
|
|
|
- $name = Inflector::underscore(preg_replace('/(Shell|Command)$/', '', $file));
|
|
|
- //if names are equal, we did not use the defaultName()
|
|
|
- if ($name === $command['name']) {
|
|
|
- $command['name'] = str_replace('_', ' ', $command['name']);
|
|
|
- $command['fullName'] = str_replace('_', ' ', $command['fullName']);
|
|
|
- }
|
|
|
- $commands[$i] = $command;
|
|
|
- }
|
|
|
-
|
|
|
- return $commands;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* Scan the application for shells & commands.
|
|
|
*
|
|
|
* @return array A list of command metadata.
|