Add a command to the console.

@param  \Symfony\Component\Console\Command\Command  $command
@return \Symfony\Component\Console\Command\Command
421759
public function add(SymfonyCommand $command)
    {
        if ($command instanceof Command) {
            $command->setContainer($this->container);
        }

        return $this->addToParent($command);
    }
692019
protected function registerMakeAddonCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Addons\Commands\AddonMakeCommand($app);
        });
    }
344
public function add($command)
    {
        $tasks = $this->prepper
                    ->load(get_class($command))
                    ->describe();

        $this->library->add(['task' => $tasks, 'class' => $command]);

        return $this;
    }
41300
public function add(BaseCommand $command)
    {
        if ($ret = parent::add($command)) {
            if ($ret instanceof ContextAware) {
                $ret->setContext($this->context);
            }

            if ($ret instanceof PresenterAware) {
                $ret->setPresenter($this->config->getPresenter());
            }

            if (isset($this->commandsMatcher)) {
                $this->commandsMatcher->setCommands($this->all());
            }
        }

        return $ret;
    }
1177804
public function register($command)
    {
        $classexp = explode('/', $command);
        for ($i = 0; $i < count($classexp); $i++) {
            $classexp[$i] = ucwords($classexp[$i]);
        }

        $class = __NAMESPACE__.'\\'.implode('\\', $classexp);

        return new $class();
    }
221583
public function add(CommandInterface $command)
    {
        $this->sequence[] = $command;

        if ($this->hasConfig()) {
            $command->setConfig($this->getConfig());
        }

        return $this;
    }
81631
protected function doAction(Command $command)
    {
        if ($command->name() === '__default__') {
            return $this->notFound();
        }

        // Let the command collect more data (if missing or needs confirmation)
        $command->interact($this->io());

        if (!$command->action() && !\method_exists($command, 'execute')) {
            return;
        }

        $params = [];
        $values = $command->values();
        // We prioritize action to be in line with commander.js!
        $action = $command->action() ?? [$command, 'execute'];

        foreach ($this->getActionParameters($action) as $param) {
            $params[] = $values[$param->getName()] ?? null;
        }

        return $action(...$params);
    }
285224
private function call($command)
    {
        if (!in_array($command, static::COMMAND)) {
            $this->throwFailsCommand("The command '$command' not exists.", 'help');
        }

        if (!$this->arg->getParameter('action')) {
            if ($this->arg->getParameter('target') == 'help') {
                $this->help($command);

                exit(0);
            }
        }

        try {
            call_user_func_array(
                [$this, $command],
                [$this->arg->getParameter('target')]
            );
        } catch (\Exception $e) {
            echo $e->getMessage();

            exit(1);
        }
    }
1291407
public function addCommand($command, $config = array())
    {
        if (!($command instanceof KControllerToolbarCommand)) {
            $command = $this->getCommand($command, $config);
        }

        return $this->getDelegate()->addCommand($command, $config);
    }
1314540
public function execute(Command $command)
    {
        $this->log('Executing command [' . get_class($command) . ']', $command);

        try {
            $response = $this->innerCommandBus->execute($command);
        } catch (\Exception $e) {

            $message = 'Failed executing command [' . get_class($command) . ']. ' . $this->createExceptionString($e);
            $this->log($message, $command);
            throw $e;
        }

        $this->log('Successfully executed command [' . get_class($command) . ']', $command);

        return $response;
    }
992472
public function aExecuteCommandTo($command) {
        $this->restartKernel();
        $kernel = $this->getKernel();

        $application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
        $application->setAutoExit(false);

        $exploded = explode(" ", $command);

        $commandsParams = [
        ];
        foreach ($exploded as $value) {
            if (!isset($commandsParams["command"])) {
                $commandsParams["command"] = $value;
            } else {
                $e2 = explode("=", $value);
//                var_dump($e2);
                if (count($e2) == 1) {
                    $commandsParams[] = $e2[0];
                } else if (count($e2) == 2) {
                    $commandsParams[$e2[0]] = $e2[1];
                }
            }
        }
        foreach ($commandsParams as $key => $value) {
            $commandsParams[$key] = $value;
        }
        $input = new \Symfony\Component\Console\Input\ArrayInput($commandsParams);
        if ($output === null) {
            $output = new \Symfony\Component\Console\Output\ConsoleOutput();
        }
        $application->run($input, $output);
//         $content = $output->fetch();
    }
1310754
protected function addCommand(Command $handler): void
	{
		$handler->setBot($this);
		$command = $handler->getName();
		$this->commands[strtoupper($command)] = $handler;
	}
1009586
public function addConsole($command) {
        /* @var $command Command */
        $command->configure();
        $name = $command->name();
        $this->defaultCommand[ $name ] = $command;
    }
551186
public function addCommand($command, $config = array())
    {
        if (! ($command instanceof  AnControllerToolbarCommand)) {
            $command = $this->getCommand($command, $config);
        }

        $this->_commands[$command->getName()] = $command;
        return $this;
    }
32617
public function register(CommandInterface $command)
    {
        /*
         * Gets the name of the command
         * @var string
         */
        $name = $command->getCommand();

        /*
         * Check if the command isn't already registered
         * otherwise throw an exception
         */
        if (array_key_exists($name, $this->commands)) {
            throw new CommandException("Command with name '$name' already registered");
        }

        /*
         * Adds the command to the array
         */
        $this->commands[$name] = $command;
    }
1075591
public function execute(Command $command)
    {
        $handler = $this->resolver->resolve($command);

        return $handler->handle($command);
    }
339054
public function command($command, $method) {

        self::$commands[] = $command;
        self::$callbacks[$command] = $method;
    }