8000 [Console] Table helper vertical rendering · Issue #41595 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Table helper vertical rendering #41595

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
yoannrenard opened this issue Jun 7, 2021 · 3 comments · Fixed by #41676
Closed

[Console] Table helper vertical rendering #41595

yoannrenard opened this issue Jun 7, 2021 · 3 comments · Fixed by #41676

Comments

@yoannrenard
Copy link
Contributor

Description
The usage of large Tables in console especially on small screens (like my laptop unfortunately) is not pleasant and hard to use (like the bin/console debug:validator src/ command which prints a huge table hard to read).
What do you think about having a system like mysql or postgresql have (with the "\G" terminator) that would convert the original direction output into a vertical way?

Example

+---------------+--------------------------+------------------+---------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ISBN          | Title                    | Author           | Review                                                                                                  
                                                                                                                                                                        
                                                                                                                                                                        
                                                                                                                                                                   |
+---------------+--------------------------+------------------+---------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 99921-58-10-7 | Divine Comedy            | Dante Alighieri  | The Divine Comedy describes Dante's descent into Hell with Virgil as a guide; his ascent of Mount Purgat
ory and encounter with his dead love, Beatrice; and finally, his arrival in Heaven.                                                                                     
                                                                                                                                                                        
                                                                                                                                                                   |
| 9971-5-0210-0 | A Tale of Two Cities     | Charles Dickens  | A Tale of Two Cities is Charles Dickens’s great historical novel, set against the violent upheaval of th
e French Revolution. The most famous and perhaps the most popular of his works, it compresses an event of immense complexity to the scale of a family history, with a ca
st of characters that includes a bloodthirsty ogress and an antihero as believably flawed as any in modern fiction. Though the least typical of the author’s novels, A T
ale of Two Cities still underscores many of his enduring themes—imprisonment, injustice, social anarchy, resurrection, and the renunciation that fosters renewal.  |
| 960-425-059-0 | The Lord of the Rings    | J. R. R. Tolkien | The Lord of the Rings tells of the great quest undertaken by Frodo and the Fellowship of the Ring: Ganda
lf the Wizard; the hobbits Merry, Pippin, and Sam; Gimli the Dwarf; Legolas the Elf; Boromir of Gondor; and a tall, mysterious stranger called Strider.                 
                                                                                                                                                                        
                                                                                                                                                                   |
+---------------+--------------------------+------------------+---------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Would become :

*************************** 1. row ***************************
   ISBN: 99921-58-10-7
  Title: Divine Comedy
 Author: Dante Alighieri
 Resume: The Divine Comedy describes Dante's descent into Hell with Virgil as a guide; his ascent of Mount Purgatory and encounter with his dead love, Beatrice; and fin
ally, his arrival in Heaven. 
*************************** 2. row ***************************
   ISBN: 9971-5-0210-0
  Title: A Tale of Two Cities
 Author: Charles Dickens
 Resume: A Tale of Two Cities is Charles Dickens’s great historical novel, set against the violent upheaval of the French Revolution. The most famous and perhaps the mo
st popular of his works, it compresses an event of immense complexity to the scale of a family history, with a cast of characters that includes a bloodthirsty ogress an
d an antihero as believably flawed as any in modern fiction. 
*************************** 3. row ***************************
   ISBN: 960-425-059-0
  Title: The Lord of the Rings
 Author: J. R. R. Tolkien
 Resume: The Lord of the Rings tells of the great quest undertaken by Frodo and the Fellowship of the Ring: Gandalf the Wizard; the hobbits Merry, Pippin, and Sam; Giml
i the Dwarf; Legolas the Elf; Boromir of Gondor; and a tall, mysterious stranger called Strider.

It could be a parameter to set as does setHorizontal()

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@carsonbot
Copy link

Just a quick reminder to make a comment on this. If I don't hear anything I'll close this.

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

GromNaN added a commit that referenced this issue May 9, 2022
This PR was merged into the 6.1 branch.

Discussion
----------

[Console] Table vertical rendering

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #41595
| License       | MIT
| Doc PR        |

This PR adds a way to render Console Tables vertically. This is inspired by the way MySQL and PostgreSQL do with the '\G' command terminator.
For example, if we use this vertical rendering for the command `debug:validator`, the command would show something like:
```bash
App\Entity\Foo
-------------------

+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property: bar                                                                                                                                                       |
|     Name: Symfony\Component\Validator\Constraints\Length                                                                                                            |
|   Groups: Default, Foo                                                                                                                                              |
|  Options: [                                                                                                                                                         |
|   "maxMessage" => "This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.",   |
|   "minMessage" => "This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.", |
|   "exactMessage" => "This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.",                                 |
|   "charsetMessage" => "This value does not match the expected {{ charset }} charset.",                                                                              |
|   "max" => 75,                                                                                                                                                      |
|   "min" => 2,                                                                                                                                                       |
|   "charset" => "UTF-8",                                                                                                                                             |
|   "normalizer" => null,                                                                                                                                             |
|   "allowEmptyString" => false,                                                                                                                                      |
|   "payload" => null                                                                                                                                                 |
| ]                                                                                                                                                                   |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ...                                                                                                                                                                 |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+

```
Instead of :
```bash
App\Entity\Foo
-------------------

+----------+------------------------------------------------+------------------------------------------------+----------------------------------------------------------------------------------+
| Property | Name                                           | Groups                                         | Options                                                                          |
+----------+------------------------------------------------+------------------------------------------------+----------------------------------------------------------------------------------+
| bar      | Symfony\Component\Validator\Constraints\Length | Default, Foo                                   | [                                                                                |
|          |                                                |                                                |   "maxMessage" => "This value                                                    |
|          |                                                |                                                | is too long. It should have {{ limit }} character or less.|This value is too lon |
|          |                                                |                                                | g. It should have {{ limit }} characters or less.",                              |
|          |                                                |                                                |   "minMessage" => "This value                                                    |
|          |                                                |                                                | is too short. It should have {{ limit }} character or more.|This value is too sh |
|          |                                                |                                                | ort. It should have {{ limit }} characters or more.",                            |
|          |                                                |                        
63E5
                        |   "exactMessage" => "This valu                                                   |
|          |                                                |                                                | e should have exactly {{ limit }} character.|This value should have exactly {{ l |
|          |                                                |                                                | imit }} characters.",                                                            |
|          |                                                |                                                |   "charsetMessage" => "This va                                                   |
|          |                                                |                                                | lue does not match the expected {{ charset }} charset.",                         |
|          |                                                |                                                |   "max" => 75,                                                                   |
|          |                                                |                                                |   "min" => 2,                                                                    |
|          |                                                |                                                |   "charset" => "UTF-8                                                   |
|          |                                                |                                                | 208m",                                                                           |
|          |                                                |                                                |   "normalizer" => null                                                   |
|          |                                                |                                                | ;208m,                                                                           |
|          |                                                |                                                |   "allowEmptyString" => false                                                   |
|          |                                                |                                                | [0;38;5;208m,                                                                    |
|          |                                                |                                                |   "payload" => null                                                   |
|          |                                                |                                                | 8m                                                                               |
|          |                                                |                                                | ]                                                                                |
...
+----------+------------------------------------------------+------------------------------------------------+----------------------------------------------------------------------------------+

```
Which is hard to read.

Commits
-------

15fa4c5 Console Table vertical rendering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0