Skip to content

[Console] Exclude empty namespaces in text descriptor #19954

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

Merged
merged 1 commit into from
Mar 22, 2017
Merged

[Console] Exclude empty namespaces in text descriptor #19954

merged 1 commit into from
Mar 22, 2017

Conversation

ro0NL
Copy link
Contributor

@ro0NL ro0NL commented Sep 17, 2016

Q A
Branch? "master"
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets comma-separated list of tickets fixed by the PR, if any
License MIT
Doc PR reference to the documentation PR, if any

Before:

$ bin/console

 doctrine
  doctrine:mapping:convert                [orm:convert:mapping] Convert mapping information between supported formats.
 orm <----
 router
  router:match                            Helps debug routes by simulating a path info match

$ bin/console list orm

  [Symfony\Component\Debug\Exception\ContextErrorException]  
  Warning: max(): Array must contain at least one element  

$ bin/console list generate

Available commands for the "generate" namespace:
  generate:bundle      Generates a bundle
  generate:command     Generates a console command
  generate:controller  Generates a controller

After:

$ bin/console

 doctrine
  doctrine:mapping:convert                [orm:convert:mapping] Convert mapping information between supported formats.
 router
  router:match                            Helps debug routes by simulating a path info match

$ bin/console list orm

Available commands for the "orm" namespace:
  orm:convert:mapping  Convert mapping information between supported formats.

$ bin/console list generate

Available commands for the "generate" namespace:
  generate:bundle             Generates a bundle
  generate:command            Generates a console command
  generate:controller         Generates a controller
  generate:doctrine:crud      Generates a CRUD based on a Doctrine entity
  generate:doctrine:entities  Generates entity classes and method stubs from your mapping information
  generate:doctrine:entity    Generates a new Doctrine entity inside a bundle
  generate:doctrine:form      Generates a form type class based on a Doctrine entity

Overrules #19776 but also includes other fixes related to aliases that popped up when writing tests 👍

@ro0NL ro0NL changed the title [Console] Include alias commands in text descriptor [Console] Exlude empty namespaces in text descriptor Sep 17, 2016
@ro0NL ro0NL changed the title [Console] Exlude empty namespaces in text descriptor [Console] Exclude empty namespaces in text descriptor Sep 17, 2016
@fabpot
Copy link
Member

fabpot commented Sep 17, 2016

Can you add a unit test to avoid regressions? Thanks.

@@ -13,8 +13,9 @@ My Symfony application <info>v1.0</info>
<info>-v|vv|vvv, --verbose</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

<comment>Available commands:</comment>
<info>help</info> Displays help for a command
<info>list</info> Lists commands
<info>help</info> Displays help for a command
Copy link
Contributor Author

@ro0NL ro0NL Sep 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getColumnWidth considers aliases (descriptor:alias_command3), but we explicitly not render those.. not sure how to solve it..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you have the same logic in getColumnWidth to have the same "exclusion rules"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@ro0NL
Copy link
Contributor Author

ro0NL commented Sep 17, 2016

@fabpot maybe 72374eb should target 2.7 to ease future upstream merges/diffs...

@fabpot
Copy link
Member

fabpot commented Sep 17, 2016

Indeed, merging it in 2.7 would greatly help

@ro0NL
Copy link
Contributor Author

ro0NL commented Sep 17, 2016

Would a PR do? Can you also please have a look at #19776 and decide what to do? I'd prefer this PR as a whole (all fixes can target master).

@@ -20,5 +20,6 @@ public function __construct()
parent::__construct('My Symfony application', 'v1.0');
$this->add(new DescriptorCommand1());
$this->add(new DescriptorCommand2());
$this->add(new DescriptorCommand3());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, i chose this approach on testing to include the case in other formats as well (Markdown, XML, etc.). This to avoid future regressions as well.

@fabpot
Copy link
Member

fabpot commented Oct 5, 2016

Can you rebase on current master?

@ro0NL
Copy link
Contributor Author

ro0NL commented Oct 5, 2016

Done.

@javiereguiluz javiereguiluz added this to the 3.2 milestone Nov 7, 2016
@fabpot fabpot removed this from the 3.2 milestone Nov 16, 2016
@nicolas-grekas nicolas-grekas added this to the 3.x milestone Dec 6, 2016
@fabpot
Copy link
Member

fabpot commented Mar 22, 2017

@ro0NL Sorry about that but can you rebase one last time? When done, ping me so that I can merge ASAP to avoid any problems. Thanks.

@ro0NL
Copy link
Contributor Author

ro0NL commented Mar 22, 2017

@fabpot done. Replayed the before/after scenarios once more, and still all good. Waiting for travis though :)

edit: green :)

@fabpot
Copy link
Member

fabpot commented Mar 22, 2017

Thank you @ro0NL.

@fabpot fabpot merged commit d5a7608 into symfony:master Mar 22, 2017
fabpot added a commit that referenced this pull request Mar 22, 2017
…(ro0NL)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[Console] Exclude empty namespaces in text descriptor

| Q | A |
| --- | --- |
| Branch? | "master" |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any |
| License | MIT |
| Doc PR | reference to the documentation PR, if any |

Before:

```
$ bin/console

 doctrine
  doctrine:mapping:convert                [orm:convert:mapping] Convert mapping information between supported formats.
 orm <----
 router
  router:match                            Helps debug routes by simulating a path info match

$ bin/console list orm

  [Symfony\Component\Debug\Exception\ContextErrorException]
  Warning: max(): Array must contain at least one element

$ bin/console list generate

Available commands for the "generate" namespace:
  generate:bundle      Generates a bundle
  generate:command     Generates a console command
  generate:controller  Generates a controller
```

After:

```
$ bin/console

 doctrine
  doctrine:mapping:convert                [orm:convert:mapping] Convert mapping information between supported formats.
 router
  router:match                            Helps debug routes by simulating a path info match

$ bin/console list orm

Available commands for the "orm" namespace:
  orm:convert:mapping  Convert mapping information between supported formats.

$ bin/console list generate

Available commands for the "generate" namespace:
  generate:bundle             Generates a bundle
  generate:command            Generates a console command
  generate:controller         Generates a controller
  generate:doctrine:crud      Generates a CRUD based on a Doctrine entity
  generate:doctrine:entities  Generates entity classes and method stubs from your mapping information
  generate:doctrine:entity    Generates a new Doctrine entity inside a bundle
  generate:doctrine:form      Generates a form type class based on a Doctrine entity
```

Overrules #19776 but also includes other fixes related to aliases that popped up when writing tests 👍

Commits
-------

d5a7608 [Console] Exclude empty namespaces in text descriptor
@ro0NL ro0NL deleted the console/command-aliases branch March 22, 2017 18:52
@nicolas-grekas nicolas-grekas modified the milestones: 3.x, 3.3 Mar 24, 2017
@fabpot fabpot mentioned this pull request May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants