-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Only show relevant columns in debug:router
call
#59780
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
base: 7.4
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
debug:router
call
821481d
to
44577d0
Compare
Oddly enough the tests work locally. Any idea why? Or is there a way to generate the expected output from the input? |
Can you share some before/after screenshots? |
Added screenshots oddly enough it does not show the deprecation notice I added. |
debug:router
calldebug:router
call
65d4a5f
to
f7384d1
Compare
Okay the last remaining error I presume is because the CI tests do not use a true color terminal. Question: should I set the CI colors to use |
f7384d1
to
623d688
Compare
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
Outdated
Show resolved
Hide resolved
@mamazu I like this a lot. Thanks! Two quick comments: (1): I'd use the HTTP method colors from the OpenAPI standard (and keep (2): I'm divided about outputting the controller. It's useful, but it will break the table design for most people. See your screenshot. Even if you use very short controllers (most folks will display long FQCN) the resulting table is pretty wide. In practice, each row could be displayed in two rows instead. So, why not display each route in two lines since the beginning to avoid breaking the design? |
@javiereguiluz Thanks for the feedback.
|
af774f0
to
fe882b3
Compare
Because you mentioned "grepability", another approach can also be to use |
You are completely correct, the text representation contains the least amount of infos anyways, so any other format for searching would also work. |
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/empty_route_collection.json
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/empty_route_collection.xml
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.xml
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_with_generic_host.xml
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
Outdated
Show resolved
Hide resolved
d5d400c
to
b6f285a
Compare
The test failures aren't related to the feature. |
@nicolas-grekas So I've removed the deprecation. (I don't know if I can remove the deprecation tag from the PR) Secondly I don't know how the pipeline failures are related to the feature. Could you please restart it or is there anything else I could do? |
2cf3244
to
9fad15b
Compare
if (count($methods) === 0) { | ||
$methods = ['ANY']; | ||
} | ||
|
||
return implode('|', array_map( | ||
fn (string $method): string => sprintf('<fg=%s>%s</>', self::VERB_COLORS[$method] ?? 'default', $method), | ||
$methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (count($methods) === 0) { | |
$methods = ['ANY']; | |
} | |
return implode('|', array_map( | |
fn (string $method): string => sprintf('<fg=%s>%s</>', self::VERB_COLORS[$method] ?? 'default', $method), | |
$methods | |
return implode('|', array_map( | |
fn (string $method): string => sprintf('<fg=%s>%s</>', self::VERB_COLORS[$method] ?? 'default', $method), | |
$methods ?: ['ANY'] |
'' !== $route->getHost() ? $route->getHost() : 'ANY', | ||
$this->formatControllerLink($controller, $route->getPath(), $options['container'] ?? null), | ||
'Name' => $name, | ||
'Methods' => $this->formatMethods($route->getMethods()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no way to disable colors which is BC break if someone depends on the output, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, currently there is no BC layer planned. As discussed in the thread we don't expect anyone using this output for automation (like scripting) and only for visual output.
Rebased to 7.4 and fixed the conflicts. |
What I did
Always showing the controllers in the list view (we but not removing the--show-controllers
so it's not a BC break)Why
Screenshots
Before:

After:
