Repository: symfony/symfony
File: src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php (PHP)

Code before:
    <info>php %command.full_name% <receiver-name> --queues=fasttrack</info>

Use the --no-reset option to prevent services resetting after each message (may lead to leaking services' state between messages):

    <info>php %command.full_name% <receiver-name> --no-reset</info>

Use the --all option to consume from all receivers:

    <info>php %command.full_name% --all</info>

Use the --exclude-receivers option to exclude specific receivers/transports from consumption (can only be used with --all):

    <info>php %command.full_name% --all --exclude-receivers=<receiver-name></info>
EOF
            )
        ;
    }

    protected function initialize(InputInterface $input, OutputInterface $output): void
    {
        if ($input->hasParameterOption('--keepalive')) {
            $this->getApplication()->setAlarmInterval((int) ($input->getOption('keepalive') ?? self::DEFAULT_KEEPALIVE_INTERVAL));
        }

        if ($input->getOption('exclude-receivers') && !$input->getOption('all')) {
            throw new InvalidOptionException('The --exclude-receivers option can only be used with the --all option.');
        }
    }

    protected function interact(InputInterface $input, OutputInterface $output): void
    {
        $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);

        if ($input->getOption('all')) {
            return;
        }

        if ($this->receiverNames && !$input->getArgument('receivers')) {
            if (1 === \count($this->receiverNames)) {
                $input->setArgument('receivers', $this->receiverNames);

                return;
            }

            $io->block('Which transports/receivers do you want to consume?', null, 'fg=white;bg=blue', ' ', true);

            $io->writeln('Choose which receivers you want to consume messages from in order of priority.');
            if (\count($this->receiverNames) > 1) {
                $io->writeln(\sprintf('Hint: to consume from multiple, use a list of their names, e.g. <comment>%s</comment>', implode(', ', $this->receiverNames)));
            }


Review comment (suggestion):
```suggestion
            throw new InvalidOptionException('The "--exclude-receivers" option can only be used with the "--all" option.');
```

Code after:
                    <info>php %command.full_name% <receiver-name> --queues=fasttrack</info>

                Use the <info>--no-reset</info> option to prevent services resetting after each message (may lead to leaking services' state between messages):

                    <info>php %command.full_name% <receiver-name> --no-reset</info>

                Use the <info>--all</info> option to consume from all receivers:

                    <info>php %command.full_name% --all</info>

                Use the <info>--exclude-receivers</info> option to exclude specific receivers/transports from consumption (can only be used with <info>--all</info>):

                    <info>php %command.full_name% --all --exclude-receivers=<receiver-name></info>
                EOF
            )
        ;
    }

    protected function initialize(InputInterface $input, OutputInterface $output): void
    {
        if ($input->hasParameterOption('--keepalive')) {
            $this->getApplication()->setAlarmInterval((int) ($input->getOption('keepalive') ?? self::DEFAULT_KEEPALIVE_INTERVAL));
        }

        if ($input->getOption('exclude-receivers') && !$input->getOption('all')) {
            throw new InvalidOptionException('The "--exclude-receivers" option can only be used with the "--all" option.');
        }
    }

    protected function interact(InputInterface $input, OutputInterface $output): void
    {
        $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);

        if ($input->getOption('all')) {
            return;
        }

        if ($this->receiverNames && !$input->getArgument('receivers')) {
            if (1 === \count($this->receiverNames)) {
                $input->setArgument('receivers', $this->receiverNames);

                return;
            }

            $io->block('Which transports/receivers do you want to consume?', null, 'fg=white;bg=blue', ' ', true);

            $io->writeln('Choose which receivers you want to consume messages from in order of priority.');
            if (\count($this->receiverNames) > 1) {
                $io->writeln(\sprintf('Hint: to consume from multiple, use a list of their names, e.g. <comment>%s</comment>', implode(', ', $this->receiverNames)));
            }