Add a dynamic method that extends the mapper/repository.

@param string $command
180548
public function addCustomCommand($command)
    {
        $name = lcfirst(class_basename($command));

        $this->customCommands[$name] = $command;
    }
936920
public function add(Command $command)
    {
        $command->setApplication($this);

        if (!$command->isEnabled()) {
            $command->setApplication(null);

            return;
        }

        if (null === $command->getDefinition()) {
            throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
        }

        $this->commands[$command->getName()] = $command;

        foreach ($command->getAliases() as $alias) {
            $this->commands[$alias] = $command;
        }

        return $command;
    }
809137
public function execute($command, AnCommandContext $context)
    {
        $identifier = $context->caller->getIdentifier();
        $type = $identifier->path;
        $type = array_pop($type);
        $parts = explode('.', $command);
        $method = '_'.($parts[0]).ucfirst($type).ucfirst($parts[1]);
        if (method_exists($this, $method)) {
            return $this->$method($context);
        }
    }
1209845
public function addCommand(Command $command)
    {
        if (is_string($command)) {
            $command = new $command;
        }
        $map = (new CommandMapping($this->parser))->map($command);

        CommandBag::add($map->name, [
            'object' => $command,
            'map' => $map
        ]);

        return $this;
    }
547994
public function add($name, $command)
    {
        // Once we have a new Command class this should check
        // against that interface.
        if (!is_subclass_of($command, Shell::class) && !is_subclass_of($command, Command::class)) {
            $class = is_string($command) ? $command : get_class($command);
            throw new InvalidArgumentException(
                "Cannot use '$class' for command '$name' it is not a subclass of Cake\Console\Shell or Cake\Console\Command."
            );
        }
        if (!preg_match('/^[^\s]+(?:(?: [^\s]+){1,2})?$/ui', $name)) {
            throw new InvalidArgumentException(
                "The command name `{$name}` is invalid. Names can only be a maximum of three words."
            );
        }

        $this->commands[$name] = $command;

        return $this;
    }
1063279
protected function registerDatabaseSeedCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Database\Commands\DatabaseSeedCommand($app);
        });
    }
123324
protected function registerDatabaseRefreshCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Database\Commands\DatabaseRefreshCommand($app);
        });
    }
1036292
public function add(SymfonyCommand $command)
	{
		if ($command instanceof Command)
		{
			$command->setFlyphp($this->flyphp);
		}

		return $this->addToParent($command);
	}
344069
public static function configure(Command $command)
    {
        $command->setName('migrations:list')
            ->setDescription('Prints version IDs for all available migrations ordered incrementally.')
            ->addOption(
                'newest-first',
                null,
                InputOption::VALUE_NONE,
                'Sort list in reverse order (newest first)'
            );
    }
437581
protected function registerHashMakeCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Commands\HashMakeCommand($app);
        });
    }
537814
public function addCommand(Command $command)
    {
        foreach ($command->getOptions() as $option) {
            if ($this->conflicts($option)) {
                throw new \InvalidArgumentException('$command has conflicting options');
            }
        }
        $this->commands[$command->getName()] = $command;
        return $this;
    }
77930
protected function registerMakeMigrationCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Database\Commands\MigrationMakeCommand($app);
        });
    }
344
public function add($command)
    {
        $tasks = $this->prepper
                    ->load(get_class($command))
                    ->describe();

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

        return $this;
    }
776026
protected function registerMakeMiddlewareCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\MiddlewareMakeCommand($app);
        });
    }
350215
protected function setCommand($command)
    {
        $this->command = $command;

        if (!is_null($this->loader)) {
            $this->loader->setCommand($this->command);
        }
    }
781732
protected function validateCommand($command) {
        if ( ! is_string($command) && ! is_object($command)) {
            throw new InvalidCommandException(s(
                'Command must be either a class name or an instance, "%s" given.',
                get_type($command)
            ));
        }

        if (is_string($command) && ! class_exists($command)) {
            throw new InvalidCommandException(s(
                'Command "%s" does not exist.',
                $command
            ));
        }

        if ( ! method_exists($command, 'setup') || ! method_exists($command, 'run')) {
            throw new InvalidCommandException(s(
                'Command "%s" must implement methods "setup" and "run".',
                get_type($command)
            ));
        }
    }
339054
public function command($command, $method) {

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