cakephp: When executing a subcommand, can't the plugin name be camelCase?
Description
I can execute subcommands like cake my_plugin.my_command mysubcommand, but I cannot execute them with the plugin name in camel case, like cake MyPlugin.my_command mysubcommand. Is this a bug? The version of CakePHP is 5.0.9.
CakePHP Version
5.0.9
PHP Version
8.1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (15 by maintainers)
Commits related to this issue
- Align command help output with callable form Use underscore inflection when printing plugin names in command list help. Underscore conventions are generally more common in CLI contexts vs camelCase. ... — committed to cakephp/cakephp by markstory a year ago
- Make command runner handle plugin inflection. Refs #17728 — committed to cakephp/cakephp by markstory a year ago
- Improve console help (#18731) Align command help output with callable form Use underscore inflection when printing plugin names in command list help. Underscore conventions are generally more common... — committed to cakephp/cakephp by markstory a year ago
Totally agree that is inconsistent. We should give output that is easier to copy/paste.
The opposite should be the case: By default CLI commands are always underscored, so having the camelCase support seems weird and inconsistent. It could still work but probably should not be displayed. So:
bin/cake my_plugin_command bin/cake my_awesome_plugin.my_plugin_command
would both work with the first being shown - I would imagine.
The pattern in the URL is defined by the RouteClass which by default is the dashed route, so your case would be
But nonetheless, URL patterns shouldn’t dictate how we reference parts of our code - especially since this issue is CLI specific and therefore has nothing to do with how cake structures its URLs by default.
The only reason I can see plugin prefixes being useful is the fact, if 2 plugins provide the same command. Otherwise,
bin/cake my_testwouldn’t be unique if both PluginA and PluginB provide theMyTestCommandclass.Therefore, I’d suggest we remove the plugin underscore behaviour in 6.x. Of course just calling
bin/cake my_testwill still work if that command is unique, but otherwise this can also - only - be called viabin/cake MyPlugin.my_testand notbin/cake my_plugin.my_testanymore