Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] command list ordering, styles in command names bugfix #12051 #12500

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
wants to merge 4 commits into from

Conversation

spdionis
Copy link

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes?
Fixed tickets #12051
License MIT

This is my first pull request, hope everything is alright.

  • Fixes command ordering. Previously if you had a command with name 0name it would show up before the global commands.
  • Fixes command name looking different from the real one because of styling.

@spdionis spdionis changed the title #12051 command name colors [Console] #12051 command name colors Nov 18, 2014
@spdionis spdionis changed the title [Console] #12051 command name colors [Console] command list ordering, styles in command names bugfix #12051 Nov 18, 2014
@javiereguiluz
Copy link
Member

@spdionis thanks for this PR and congrats on being your first one!

As you may have noticed, the service that we use to test all the submitted PR has produced an error and that's why this PR cannot be considered to be merged yet.

Here you can find the details about the result of executing the unit tests: https://travis-ci.org/symfony/symfony/jobs/41312055

If you prefer to execute the tests in your own machine, please read this article about how to do it: http://symfony.com/doc/current/contributing/code/tests.html

@stof
Copy link
Member

stof commented Nov 20, 2014

@javiereguiluz the issue is actually that the PR has been sent to the master branch, which is now 3.0.x-dev. but Travis cannot install dev dependencies for the master branch, because some of them (Doctrine for instance) are depending on the 2.x version of Symfony components.

PRs have to be sent to 2.7 (which is the default branch on github btw) or older for Travis to test them (we will need to figure a way to make test run on 3.0. We cannot force Doctrine to document compatibility with 3.0 yet, especially not in stable releases)

@spdionis spdionis force-pushed the #12051-command-name-colors branch from ad42f69 to 1591f78 Compare November 21, 2014 00:31
@spdionis
Copy link
Author

@stof @javiereguiluz Initially there were also some failing tests that now run correctly. I missed them before because i was working on windows. A lot of tests fail on windows on vanilla repository, i'm not sure why.

If needed I can open against 2.7 branch.

@fabpot fabpot added the Console label Dec 7, 2014
@spdionis
Copy link
Author

ping @stof @javiereguiluz tests run fine.

foreach ($commands as $name => $command) {
$key = $this->application->extractNamespace($name, 1);
if (!$key) {
$key = '_global';
$globalCommands['_global'][$name] = $command;
Copy link
Member

Choose a reason for hiding this comment

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

I suggest the _global key here, build $globalCommands as being only the array of global commands themselves, and the prepending this array in the list of commands after the sorting with array_shift($namespacedCommands, $globalCommands) (and doing it only in case the list of global commands is not empty to avoid useless work)

Copy link
Member

Choose a reason for hiding this comment

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

hmm, actually no. The switch from array_merge to array_shift won't work because the code expects to have a _global key for global commands. But the global key could be handle at the time of merging, keeping $globalCommands as the list of global commands (which is not the case currently)

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure what you meant here. Anyway I know that $globalCommands['_global'] feels redunant but in my opinion is it fine. The array_merge call later looks pretty straightforward this way.

@fabpot
Copy link
Member

fabpot commented Feb 11, 2015

@spdionis It would help if you could split this PR into 2 PRs, one for each bug fix.

@spdionis
Copy link
Author

I added a test that checks both command order and formatting. I can't separate the PRs though because one changes the expected output of the other. I'm also not sure I'm testing this the right way, if it's not point me in the right direction please.

Sorry for the late answer.

EDIT: looks like the test fails on travis, but it passes on my vagrant box. This test is too fragile...

EDIT2: test passes now

@fabpot
Copy link
Member

fabpot commented Oct 5, 2015

Closing in favor of #16123

@fabpot fabpot closed this Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants