8000 [Console] list-command parameter --format : An option with shortcut "e" already exists. · Issue #43086 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] list-command parameter --format : An option with shortcut "e" already exists. #43086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Chris53897 opened this issue Sep 18, 2021 · 0 comments · Fixed by #43088
Closed

Comments

@Chris53897
Copy link
Contributor
Chris53897 commented Sep 18, 2021

Symfony version(s) affected: 5.4.x-dev

Description
The paramter --format of the console function list is not working correctly.

Error: An option with shortcut "e" already exists.
symfony console list --format=json
symfony console list --format=xml

Options:
symfony console list --help

works:
symfony console list
symfony console list --raw
symfony console list --env=dev

How to reproduce
composer create-project symfony/website-skeleton:"^5.4-dev" console-test
cd console-test
symfony console list --format=json

Possible solution
I guess i found the error:
In LintCommand there is a new option "exclude" and shortcut "e".
https://github.com/christingruber/symfony/blob/55704f3d9e8315abfd0b9cbacc144d80a888882c/src/Symfony/Component/Yaml/Command/LintCommand.php

I changed symfony/console/Command/Command.php for debugging

`public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
{
if($shortcut=="e")
{
var_dump($name. " : ". $shortcut);
}
else{
$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
if (null !== $this->fullDefinition) {
$this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
}
}

    return $this;
}`

After that it works.

I suggest to make 2 changes.
a) Remove the shortcut "e" from the LintCommand. There are possibly more Commands (from vendors) with invalid shortcuts. How to find them all? PR
b) Make a List of reserved Shortcuts by symfony and do not allow them in InputOption as shortcut.
Ignore them and make a warning?

@Chris53897 Chris53897 added the Bug label Sep 18, 2021
@fabpot fabpot closed this as completed Sep 20, 2021
fabpot added a commit that referenced this issue Sep 20, 2021
…mmand - solve conflict with --env -e (Chris53897)

This PR was merged into the 5.4 branch.

Discussion
----------

[Yaml] remove shortcut e for option exclude of Yaml/LintCommand - solve conflict with --env -e

…- solve conflict with --env -e

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #43086
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Fix for command options shortcut conflict

Commits
-------

bc95dbd fix: #43086 remove shortcut e for option exclude of Yaml/LintCommand - solve conflict with --env -e
derrabus added a commit that referenced this issue Sep 21, 2021
* 5.4:
  [Serializer] Save missing arguments in MissingConstructorArgumentsException
  remove support for deprecated "threadKey" parameter
  Remove useless comment in test
  [DomCrawler] Added Crawler::innerText() method
  [Form] Add the EnumType
  Fix iterrator in ServiceConfigurator
  [Console] Add support of RGB functional notation for output colors
  Add Slovak lang translation #41081
  [Validator] Add error's uid to `Count` and `Length` constraints with "exactly" option enabled
  [Validator] Add missing thai translation
  [Yaml] Add 0 to float repr
  [Translation] Add Burmese translation
  [Notifier] Update FirebaseTransport.php
  fix: #43086 remove shortcut e for option exclude of Yaml/LintCommand - solve conflict with --env -e
  Map `multipart/form-data` as `form` Content-Type
  [Serializer] Throw NotNormalizableValueException when type is not known or not in body in discriminator map
  [Yaml] Use more concise float representation in dump
  [FrameworkBundle] Remove translation data_collector BEFORE adding it to profiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
0