Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Console] Unexpected unsupported command option shortcut #18856

Copy link
Copy link
Closed
@nico-incubiq

Description

@nico-incubiq
Issue body actions

Hi,
I am using Symfony 2.8.6, and after creating a new Command, I stumbled upon an unexpected error:

An argument with name "command" already exists.
[Symfony\Component\Console\Exception\LogicException]
An argument with name "command" already exists.

After trying a lot of different solutions, I found out that the error had to do with the option shortcut I used:

$this->setName('my:super:command')
->setAliases(['my:super:commandalias'])
->setDescription('Performs some irrelevant work.')
->addOption('survey', 's', InputOption::VALUE_REQUIRED, 'My option with a shortcut.')

After changing the alias (or setting it to null), the error just stopped popping out.
Is there any obvious reason I am missing here, or is this a bug?
Because to my knowledge "s" is not used anywhere else.

Furthermore, the error is awkwardly cryptic and gave me a hard time debugging this.

Regards,
Nicolas

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.