With Magento 2, there is a command-line interface (CLI) available to run several tasks. The
bin/magento command replaces the separate shell scripts that were used in Magento 1. This command is based on the Symfony Console component and looks just like
n98-magerun that is available for Magento 1. Just like the rest of Magento 2, it's possible to extend the CLI tool with your own commands.
Adding commands to the CLI script requires some knowledge of the Symfony Console component. This recipe also uses the service layer created in the previous recipe.
In this recipe, we will add four options to the
bin/magento CLI command with the following steps:
AddCommandclass; this is used ...