Add console commands for the plugin
@param Cake\Console\CommandCollection $commands The command collection to update
@return Cake\Console\CommandCollection
@uses setVendorLinks()
@uses setWritableDirs()
770394
public function console($commands)
    {
        $this->setVendorLinks();
        $this->setWritableDirs();

        $commands->add('me_cms.add_user', AddUserCommand::class);
        $commands->add('me_cms.groups', GroupsCommand::class);
        $commands->add('me_cms.users', UsersCommand::class);
        $commands->add('me_cms.version_updates', VersionUpdatesCommand::class);

        $commands->add('me_cms.copy_config', CopyConfigCommand::class);
        $commands->add('me_cms.create_admin', CreateAdminCommand::class);
        $commands->add('me_cms.create_groups', CreateGroupsCommand::class);
        $commands->add('me_cms.fix_kcfinder', FixKcfinderCommand::class);
        $commands->add('me_cms.install', RunAllCommand::class);

        //Commands from MeTools
        $commands->add('me_cms.create_directories', CreateDirectoriesCommand::class);
        $commands->add('me_cms.create_vendors_links', CreateVendorsLinksCommand::class);
        $commands->add('me_cms.set_permissions', SetPermissionsCommand::class);

        return $commands;
    }
1073836
public CliCommandBuilder setCommands(final Iterable<String> commands) {
        if (commands == null) {
            addCliArgument(CliArgument.COMMANDS, null);
            return this;
        }
        final StringBuilder cmds = new StringBuilder();
        for (final Iterator<String> iterator = commands.iterator(); iterator.hasNext(); ) {
            cmds.append(iterator.next());
            if (iterator.hasNext()) cmds.append(',');
        }
        addCliArgument(CliArgument.COMMANDS, cmds.toString());
        return this;
    }
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;
    }
1123657
public function addTasks($command)
	{
		$this->addSection('Tasks');

		$class = new \ReflectionClass($command);
		$tasks = $class->getMethods(\ReflectionMethod::IS_PUBLIC);

		if ($tasks && count($tasks) > 0)
		{
			$list = [];
			$max  = 0;

			foreach ($tasks as $task)
			{
				if (!$task->isConstructor() && $task->name != 'execute' && $task->name != 'help')
				{
					$comment     = $task->getDocComment();
					$description = 'no description available';

					// Check for help ignore flag
					preg_match('/@museDescription ([[:alnum:] ,\.()\-\'\/]*)/', $comment, $matched);

					if ($matched && isset($matched[1]))
					{
						$description = trim($matched[1]);
					}

					$list[] = [
						'name'        => $task->name,
						'description' => $description
					];

					$max    = ($max > strlen($task->name)) ? $max : strlen($task->name);
				}
			}

			if (count($list) > 0)
			{
				foreach ($list as $item)
				{
					$this->addString($item['name'], [
						'color'       => 'blue',
						'indentation' => 2
					]);

					$this->addString(str_repeat(' ', ($max - strlen($item['name']))) . '   ');
					$this->addLine($item['description']);
				}
			}
			else
			{
				$this->addLine('There are no tasks available for this command', [
					'color'       => 'red',
					'indentation' => 2
				]);
			}
		}

		$this->addSpacer();

		return $this;
	}
349768
public function add_command($command)
    {
        if (is_string($command)) {
            $command = (new \ReflectionClass($command))->newInstance(self::$CI);
        }

        if (!$command instanceof Commands) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Argument 1 passed to %s must be an instance of %s, %s given',
                    __NAMESPACE__ . '\Cli::add_command()',
                    __NAMESPACE__ . '\Commands',
                    gettype($command)
                )
            );
        }

        $this->commands[$command->name()] = $command;
    }
78133
public static function loadCommands() {
		foreach (glob(__DIR__."/Console/Commands/*.php") as $filename) {
			$command = str_replace(".php","",str_replace(__DIR__."/Console/Commands/","",$filename));
			if ($command[0] != "_") {
				$commandClass = "\PatternLab\Console\Commands\\".$command;
				self::$commandInstances[] = new $commandClass();
			}
		}
	}
546372
public CliCommandBuilder setCommands(final String... commands) {
        if (commands == null || commands.length == 0) {
            addCliArgument(CliArgument.COMMANDS, null);
            return this;
        }
        return setCommands(Arrays.asList(commands));
    }
1244227
public function registerCommands(Console $console)
    {
        $commands = (array) $this->get('console.commands');

        foreach ($commands as $class) {
            if (class_exists($class) && is_subclass_of($class, Command::class)) {
                $console->addCommand($this->container->createObject($class));
            }
        }
    }
282525
public function addCommandGroup($groupName, $commands = [])
    {
        $group = new CommandGroup($groupName);
        foreach ($commands as $val) {
            $cmd = $this->addCommand($val);
            $group->addCommand($cmd);
        }
        $this->commandGroups[] = $group;

        return $group;
    }
336598
public void addCommands(Iterable<Command> commands) {
		Assert.notNull(commands, "Commands must not be null");
		for (Command command : commands) {
			addCommand(command);
		}
	}
47286
private function mergeCommands($commands)
	{
		$parsed = array();

		// Loop through commands
		foreach ($commands as $command)
		{
			$bits = array();

			// Break up namespaced commands
			if (strpos($command, '\\'))
			{
				$bits    = explode('\\', $command);
				$command = $bits[count($bits)-1];
				unset($bits[count($bits)-1]);
			}

			$aux =& $parsed;

			// Loop through bits and build path to element we want to set
			foreach ($bits as $b)
			{
				$aux =& $aux[$b];
			}

			// Set element
			$aux[] = $command;
		}

		return $parsed;
	}
1078077
protected function bindCommands(CommandCollection $commands, IContainer $container)
    {
        // Resolve and add each command class
        foreach (self::$commandClasses as $commandClass) {
            $commands->add($container->resolve($commandClass));
        }

        // The command to run Opulence locally requires a path to the router file
        $commands->add(new RunAppLocallyCommand(Config::get('paths', 'root') . '/localhost_router.php'));

        // The flush-cache command requires some special configuration
        try {
            $flushCacheCommand = new FlushFrameworkCacheCommand(
                new FileCache(Config::get('paths', 'tmp.framework.http') . '/cachedBootstrapperRegistry.json'),
                new FileCache(Config::get('paths', 'tmp.framework.console') . '/cachedBootstrapperRegistry.json'),
                $container->resolve(RouteCache::class),
                $container->resolve(ViewCache::class)
            );
            $commands->add($flushCacheCommand);
        } catch (IocException $ex) {
            throw new RuntimeException('Failed to resolve ' . FlushFrameworkCacheCommand::class, 0, $ex);
        }
    }
221583
public function add(CommandInterface $command)
    {
        $this->sequence[] = $command;

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

        return $this;
    }
1036292
public function add(SymfonyCommand $command)
	{
		if ($command instanceof Command)
		{
			$command->setFlyphp($this->flyphp);
		}

		return $this->addToParent($command);
	}
1295064
public function command($command)
    {
        if (! $command instanceof Command) {
            $command = $this[$command];
        }

        $this['console']->add($command);
    }
1219342
public void setCommands(java.util.Collection<Command> commands) {
        if (commands == null) {
            this.commands = null;
            return;
        }

        this.commands = new com.amazonaws.internal.SdkInternalList<Command>(commands);
    }
696630
public function addCommand($command)
    {
        if (is_array($command)) {
            foreach ($command as $cmd) {
                $this->addCommand($cmd);
            }
        }

        if (is_string($command)) {
            $command = new Command($command);
            $this->commandsList[] = $command;
        }

        return $this;
    }