To add the command and register it:

    1. Create a Command class (the recommended location is <module_dir>/Console/Command).
    2. Your Command class extends base class (Symfony\Component\Console\Command\Command) and overrides two protected methods:

    You need to Declare you command through DI in command list

    Declare your Command class in Magento\Framework\Console\CommandList using dependency injection (<module_dir>/etc/di.xml):

    <type name="Magento\Framework\Console\CommandList">
            <argument name="commands" xsi:type="array">
                <item name="check_active_status_command" xsi:type="object">Magento\CommandExample\Console\Command\CheckActiveModulesCommand</item>

    About Author

    You may also like

    No Comment

    You can post first response comment.

    Leave A Comment

    Please enter your name. Please enter an valid email address. Please enter a message.