Classes/Console/Mvc/Cli/Symfony/Command/ListCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $helper = new DescriptorHelper();
        $helper->register('txt', new TextDescriptor());
        $helper->describe($output, $this->getApplication(), [
            'format' => $input->getOption('format'),
            'raw_text' => $input->getOption('raw'),
            'show_unavailable' => $input->getOption('all'),
            'namespace' => $input->getArgument('namespace'),
            'screen_width' => (new Terminal())->getWidth() - 4,
        ]);
        $application = $this->getApplication();
        if (!$application instanceof Application) {
            return 0;
        }
        if (!$input->getArgument('namespace') && !$application->isFullyCapable() && !$input->getOption('all')) {
            $outputHelper = new SymfonyStyle($input, $output);
            $messages = [
                '',
                sprintf(
                    '<comment>TYPO3 %s.</comment>',
                    $application->hasErrors() ? 'has errors' : 'is not fully set up'
                ),
                '<comment>Command list is reduced to only show low level commands.</comment>',
                sprintf(
                    '<comment>Not listed commands will not work until %s.</comment>',
                    $application->hasErrors() ? 'the errors are fixed' : 'TYPO3 is set up'
                ),
                sprintf(
                    '<comment>Run "%s --all" to list all commands.</comment>',
                    $_SERVER['PHP_SELF']
                ),
            ];

            $outputHelper->getErrorStyle()->writeln($messages);
        }

        return null;
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $helper = new DescriptorHelper();
        $helper->register('txt', new TextDescriptor());
        $helper->describe($output, $this->getApplication(), [
            'format' => $input->getOption('format'),
            'raw_text' => $input->getOption('raw'),
            'show_unavailable' => $input->getOption('all'),
            'namespace' => $input->getArgument('namespace'),
            'screen_width' => (new Terminal())->getWidth() - 4,
        ]);
        $application = $this->getApplication();
        if (!$application instanceof Application) {
            return 0;
        }
        if (!$input->getArgument('namespace') && !$application->isFullyCapable() && !$input->getOption('all')) {
            $outputHelper = new SymfonyStyle($input, $output);
            $messages = [
                '',
                sprintf(
                    '<comment>TYPO3 %s.</comment>',
                    $application->hasErrors() ? 'has errors' : 'is not fully set up'
                ),
                '<comment>Command list is reduced to only show low level commands.</comment>',
                sprintf(
                    '<comment>Not listed commands will not work until %s.</comment>',
                    $application->hasErrors() ? 'the errors are fixed' : 'TYPO3 is set up'
                ),
                sprintf(
                    '<comment>Run "%s --all" to list all commands.</comment>',
                    $_SERVER['PHP_SELF']
                ),
            ];

            $outputHelper->getErrorStyle()->writeln($messages);
        }

        return null;
    }
Subclass Symfony list command to be able to register our own text descriptor

@param InputInterface $input
@param OutputInterface $output
@throws \Symfony\Component\Console\Exception\InvalidArgumentException
@return null|int null or 0 if everything went fine, or an error code