Пример #1
0
    /**
     * Class constructor.
     *
     * @param   Input\Cli  $input   An optional argument to provide dependency injection for the application's
     *                              input object.  If the argument is a InputCli object that object will become
     *                              the application's input object, otherwise a default input object is created.
     *
     * @param   Registry   $config  An optional argument to provide dependency injection for the application's
     *                              config object.  If the argument is a Registry object that object will become
     *                              the application's config object, otherwise a default config object is created.
     *
     * @param   CliOutput  $output  The output handler.
     */
    public function __construct(Input\Cli $input = null, Registry $config = null, CliOutput $output = null)
    {
        $this->loadDispatcher();
        $input = $input ?: $this->getContainer()->get('input');
        // Make Windows no ANSI color
        if (defined('PHP_WINDOWS_VERSION_BUILD')) {
            $input->set('no-ansi', true);
        }
        \JFactory::$application = $this;
        parent::__construct($input, $config, $output);
        $this->rootCommand->setHelp(<<<HELP
Welcome to Windwalker Console.

HELP
);
        $descriptorHelper = $this->rootCommand->getChild('help')->getDescriptor();
        $descriptorHelper->setOptionDescriptor(new OptionDescriptor())->setCommandDescriptor(new CommandDescriptor());
        $this->loadFirstlevelCommands();
    }