src/Valkyrja/Console/Commands/CommandsListCommand.php
public function run(string $namespace = null): int
    {
        $commands        = console()->all();
        $longestLength   = 0;
        $previousSection = '';

        $this->filterCommands($commands, $longestLength, $namespace);

        $this->applicationMessage();
        $this->sectionDivider();

        $this->usageMessage('command [options] [arguments]');

        $this->optionsSection(...input()->getGlobalOptions());
        $this->sectionDivider();

        $this->sectionTitleMessage(
            'Commands'
            . ($namespace ? " for the \"{$namespace}\" namespace" : '')
        );

        /** @var \Valkyrja\Console\Command $command */
        foreach ($commands as $command) {
            if (null === $namespace) {
                $this->commandSection($command, $previousSection);
            }

            $this->sectionMessage(
                (! $namespace ? static::TAB : '') . $command->getName(),
                $command->getDescription(),
                $longestLength + 2
            );
        }

        return 0;
    }
public function run(string $namespace = null): int
    {
        $commands        = console()->all();
        $longestLength   = 0;
        $previousSection = '';

        $this->filterCommands($commands, $longestLength, $namespace);

        $this->applicationMessage();
        $this->sectionDivider();

        $this->usageMessage('command [options] [arguments]');

        $this->optionsSection(...input()->getGlobalOptions());
        $this->sectionDivider();

        $this->sectionTitleMessage(
            'Commands'
            . ($namespace ? " for the \"{$namespace}\" namespace" : '')
        );

        /** @var \Valkyrja\Console\Command $command */
        foreach ($commands as $command) {
            if (null === $namespace) {
                $this->commandSection($command, $previousSection);
            }

            $this->sectionMessage(
                (! $namespace ? static::TAB : '') . $command->getName(),
                $command->getDescription(),
                $longestLength + 2
            );
        }

        return 0;
    }
Run the command.

@param string $namespace [optional] The namespace to show commands for

@return int