dotkernel / dot-cli

DotKernel component to build console applications based on laminas-cli.
https://docs.dotkernel.org/dot-cli/
MIT License
5 stars 2 forks source link

Autodiscovery for existing commands in project #36

Open alexmerlin opened 4 months ago

alexmerlin commented 4 months ago

Issue: Every time a new command is created, it needs to be added manually to the project's config/autoload/cli.global.php file.


Goal:


Solution: Run through each module's dependencies and look for any class that is an instance of Symfony\Component\Console\Command\Command. After identifying commands, we can register them automatically in the application. Feature should be enabled by default, but it needs a configuration in the config file

'autodiscovery' => [
  'enabled' => true,
],

where it can be disabled making dot-cli see only the pre-configured commands.