Returns an array of all commands

@return array<Command>
@api
504392
public function getAvailableCommands(): array
    {
        if ($this->availableCommands === null) {
            $this->availableCommands = [];

            foreach (static::getCommandControllerMethodArguments($this->objectManager) as $className => $methods) {
                foreach (array_keys($methods) as $methodName) {
                    $this->availableCommands[] = new Command($className, substr($methodName, 0, -7));
                }
            }
        }

        return $this->availableCommands;
    }
214132
protected function getPhpMigCommands()
    {
        return [
            new Command\CheckCommand(),
            new Command\DownCommand(),
            new Command\GenerateCommand(),
            new Command\MigrateCommand(),
            new Command\RedoCommand(),
            new Command\RollbackCommand(),
            new Command\StatusCommand(),
            new Command\UpCommand(),
        ];
    }
867274
protected function _getCommands($controllerName)
    {
        $commands = [];

        foreach (get_class_methods($controllerName) as $method) {
            if (preg_match('#^(.*)Command$#', $method, $match) === 1 && $match[1] !== 'help') {
                $commands[] = $match[1];
            }
        }

        return $commands;
    }
555771
public function getInvertedCommands()
    {
        $inverted = new Intent();

        foreach (array_reverse($this->commands) as $com) {
            switch (true) {
                case $com instanceof CreateTable:
                    $inverted->addAction(new DropTable($com->getTable()));
                    break;

                case $com instanceof RenameTable:
                    $inverted->addAction(new RenameTable(new Table($com->getNewName()), $com->getTable()->getName()));
                    break;

                case $com instanceof AddColumn:
                    $inverted->addAction(new RemoveColumn($com->getTable(), $com->getColumn()));
                    break;

                case $com instanceof RenameColumn:
                    $column = clone $com->getColumn();
                    $name = $column->getName();
                    $column->setName($com->getNewName());
                    $inverted->addAction(new RenameColumn($com->getTable(), $column, $name));
                    break;

                case $com instanceof AddIndex:
                    $inverted->addAction(new DropIndex($com->getTable(), $com->getIndex()));
                    break;

                case $com instanceof AddForeignKey:
                    $inverted->addAction(new DropForeignKey($com->getTable(), $com->getForeignKey()));
                    break;

                default:
                    throw new IrreversibleMigrationException(sprintf(
                        'Cannot reverse a "%s" command',
                        get_class($com)
                    ));
            }
        }

        return $inverted;
    }
1152676
def commands(self):
        """"""
        if not getattr(self, "_commands", None):
            self._commands = []
            for command in self.orig_commands:
                if isinstance(command, Command):
                    command = [command]
                for instruction in command:
                    self._commands.append(instruction)
        return self._commands
823359
private function getAvailableCommands()
    {
        $commands = $this->getDefaultPiwikCommands();
        $detected = PluginManager::getInstance()->findMultipleComponents('Commands', 'Piwik\\Plugin\\ConsoleCommand');

        $commands = array_merge($commands, $detected);

        /**
         * Triggered to filter / restrict console commands. Plugins that want to restrict commands
         * should subscribe to this event and remove commands from the existing list.
         *
         * **Example**
         *
         *     public function filterConsoleCommands(&$commands)
         *     {
         *         $key = array_search('Piwik\Plugins\MyPlugin\Commands\MyCommand', $commands);
         *         if (false !== $key) {
         *             unset($commands[$key]);
         *         }
         *     }
         *
         * @param array &$commands An array containing a list of command class names.
         */
        Piwik::postEvent('Console.filterCommands', array(&$commands));

        $commands = array_values(array_unique($commands));

        return $commands;
    }
178126
protected function getBitrixCommands()
    {
        return array_merge(
            [
                new OnCronCommand(),
                new ExecuteCommand(),
                new ClearCommand(),
                new InitCommand(),
                new ReIndexCommand(),
                new ExportCommand(),
                new ImportCommand(),
                new ReIndexCommand(),
            ],
            Module\ModuleCommand::getCommands()
        );
    }
621624
public function hydrateCommands(array $commands): array
    {
        if ($this->commandFinder->isDir()) {
            $commands = array_merge($commands, $this->getCommandsFromFinder());
        }

        return $commands;
    }
1085465
public static function all()
    {
        $output = array();
        $namespaced = Command::allCustom();
        foreach ($namespaced as $namespace => $commands) {
            foreach ($commands as $title => $command) {
                if (is_a($command, 'Bkwld\Decoy\Models\Worker')) {
                    $output[] = $command;
                }
            }
        }

        return $output;
    }
1218150
public function getArgumentDefinitions(): array
    {
        if (!$this->hasArguments()) {
            return [];
        }
        $commandArgumentDefinitions = [];
        $commandMethodReflection = $this->getCommandMethodReflection();
        $annotations = $commandMethodReflection->getTagsValues();
        $commandParameters = $this->reflectionService->getMethodParameters($this->controllerClassName, $this->controllerCommandName . 'Command');
        $i = 0;
        foreach ($commandParameters as $commandParameterName => $commandParameterDefinition) {
            $explodedAnnotation = explode(' ', $annotations['param'][$i]);
            array_shift($explodedAnnotation);
            array_shift($explodedAnnotation);
            $description = implode(' ', $explodedAnnotation);
            $required = $commandParameterDefinition['optional'] !== true;
            $commandArgumentDefinitions[] = new CommandArgumentDefinition($commandParameterName, $required, $description);
            $i ++;
        }
        return $commandArgumentDefinitions;
    }
42802
public function getRoutes()
    {
        $list = array();

        foreach (glob(__DIR__ . '/config/commands/*.php') as $file) {

            $command = pathinfo($file, PATHINFO_FILENAME);
            $list[$command] = gplcart_config_get($file);

            $method = $command;
            $parts = explode('-', $command);

            if (count($parts) > 1) {
                $method = array_pop($parts);
            }

            $class_name = implode('', $parts);

            $list[$command]['handlers']['controller'] = array(
                "gplcart\\modules\\cli\\controllers\\commands\\$class_name", "cmd$method$class_name");
        }

        return $list;
    }
376737
public function aggregate()
    {
        $commands = [];
        foreach ($this->getVisibleCommands() as $name => $cmd) {
            $commands[$name] = $cmd;
        }

        foreach ($this->commandGroups as $g) {
            if ($g->isHidden) {
                continue;
            }
            foreach ($g->getCommands() as $name => $cmd) {
                unset($commands[$name]);
            }
        }

        uasort($this->commandGroups, function ($a, $b) {
            if ($a->getId() === 'dev') {
                return 1;
            }

            return 0;
        });

        return [
            'groups' => $this->commandGroups,
            'commands' => $commands,
        ];
    }
512895
public static function getCommand() {
		foreach (self::$commands as $command => $attributes) {
			if (isset(self::$options[$command]) || isset(self::$options[$attributes["commandShort"]])) {
				return $command;
			}
		}
		return false;
	}
996868
public function listCommands()
    {
        $commands = $this->library->getAll();

        foreach ($commands as $name => $details) {
            $this->output->writeln(ucwords($name));
            $this->output->hr(strlen($details['description']), '-');
            $this->output->writeln($details['description']);
            $this->output->hr(strlen($details['description']), '-');

            foreach ($details['actions'] as $action) {
                $this->output->writeln(
                    sprintf(
                        "%s - php [file] %s%s [params]",
                        $action,
                        $name,
                        ($action != 'main' ? ":$action" : '')
                    )
                );
            }

            // Just for padding
            $this->output->writeln('');
        }
    }
507802
protected function getCommandDescriptions()
    {
        $descriptions = [];
        foreach ($this->getCommands() as $command) {
            $description = '';

            $result = $this->app->createController($command);
            if ($result !== false && $result[0] instanceof Controller) {
                [$controller, $actionID] = $result;
                /** @var Controller $controller */
                $description = $controller->getHelpSummary();
            }

            $descriptions[$command] = $description;
        }

        return $descriptions;
    }
1140183
def list_all_commands(self):
        
        commands = [name for name, _ in inspect.getmembers(self, predicate=inspect.isroutine) if not name.startswith('_')]
        return commands
386047
protected function getDefaultCommands()
    {
        $commands = parent::getDefaultCommands();
        $commands[] = new Command\UseSortCommand();
        $commands[] = new Command\HeaderCommand();
        $commands[] = new Command\StrictCommand();

        return $commands;
    }