Skip to content

[Console] Command usage output invalid if argument name is a reserved style #41315

Closed
@n0rbyt3

Description

@n0rbyt3

Symfony version(s) affected: >=4.4

Description
If you name an console input argument "info" and try to use the command without arguments, the help output is incorrect.

How to reproduce

class FooBarCommand extends Command
{
    protected static $defaultName = 'foo:bar';

    protected function configure()
    {
        $this->addArgument('first', InputArgument::REQUIRED);
        $this->addArgument('info', InputArgument::REQUIRED);
        $this->addArgument('last', InputArgument::REQUIRED);
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        return Command::SUCCESS;
    }
}

Command line:

php bin\console foo:bar
[Not anough arguments info]
foo:bar <first> <last>

Possible Solution
Do not print the arguments as tags, use another delimiter instead or the output should not get formatted.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions