eightshift-libs
eightshift-libs copied to clipboard
Running boilerplate commands doesn't recognize the context
Describe your feature request
When running some CLI methods, I encountered two issues:
- If you have a theme installed alongside the plugin, for instance, and you run some CLI command in the plugin, the command will get executed in the theme (service class or some creation method), instead of a plugin
- When running some CLI commands (like main creation), you'll end up with a theme specific class, instead of plugin one:
https://github.com/infinum/eightshift-libs/blob/3c11801fcb67d29679c4d3e598565af1166e1894/src/Main/MainExample.php#L38-L41
(should be plugins_loaded
hook).
Describe the solution you'd like
The CLI commands should be aware of their context - where to create certain commands, or some parts of the example should be changed.
Also, noticed a lot of 'theme' strings in the CLI methods, which then looks odd if you use it in the plugin (and have to change this).
These should probably be modified using a placeholder that can be interchanged to theme/plugin
.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in this repo.
Yes
Please confirm that you have searched in our documentation and couldn't find the answer.
Yes
The CLI commands should be aware of their context - where to create certain commands, or some parts of the example should be changed.
In what way should they be aware? Looking at the pwd
?
I recall that somewhere in the docs it was said to change the boilerplate
command prefix in the plugin to accomplish that, I guess the reasoning is that you need to know "which" Libs registered the command 🤷
Yes, we talked about this. You need to change the prefix for the commands. I will add some kind of description in the setup process
The first part can be solved by changing the command name, the second part is still lacking. We could add a flag that will be used to distinguish between the theme and plugin maybe, and based on that search/replace certain strings and some files for the correct hooks, etc.
this is done in the latest release