Skip to content
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

[Console] Add box style table #25301

Merged
merged 1 commit into from
Dec 11, 2017
Merged

Conversation

maidmaid
Copy link
Contributor

@maidmaid maidmaid commented Dec 4, 2017

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets /
License MIT
Doc PR /

Box-drawing characters, also known as line-drawing characters, are a form of semigraphics widely used in text user interfaces to draw various geometric frames and boxes. https://en.wikipedia.org/wiki/Box-drawing_character

Box-drawing characters are done for the TableStyle; use them!

Result:

screenshot from 2017-12-04 17-09-56

@javiereguiluz
Copy link
Member

@maidmaid thanks for this contribution. And now the usual question for changes like this one: does this work perfectly on every operating system and terminal application? (We always have issues with Windows support).

@nicolas-grekas nicolas-grekas added this to the 4.1 milestone Dec 4, 2017
@maidmaid
Copy link
Contributor Author

maidmaid commented Dec 4, 2017

It supposed to work with DOS, according to the wiki page. Moreover, AppVeyor is green. But I didn't try on Windows. Maybe a Windows friend can give us a feedback? A friend like @ZHB maybe? ;)

@maidmaid
Copy link
Contributor Author

maidmaid commented Dec 6, 2017

The test script (to use as-is, without my fork):

<?php

require 'vendor/autoload.php';

use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableStyle;
use Symfony\Component\Console\Output\ConsoleOutput;

(new Table(new ConsoleOutput()))
    ->setStyle((new TableStyle())
        ->setHorizontalBorderChar('─')
        ->setVerticalBorderChar('│')
        ->setCrossingChar('┼')
    )
    ->setHeaders(array('ISBN', 'Title', 'Author'))
    ->setRows(array(
        array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
        array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
        array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
        array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
    ))
    ->render()
;

@ZHB
Copy link

ZHB commented Dec 6, 2017

The result on Windows 10 command prompt :

sf-console-box-drawing

@fabpot
Copy link
Member

fabpot commented Dec 11, 2017

Thank you @maidmaid.

@fabpot fabpot merged commit 360a984 into symfony:master Dec 11, 2017
fabpot added a commit that referenced this pull request Dec 11, 2017
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Console] Add box style table

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | /
| License       | MIT
| Doc PR        | /

> Box-drawing characters, also known as line-drawing characters, are a form of semigraphics widely used in text user interfaces to draw various geometric frames and boxes. https://en.wikipedia.org/wiki/Box-drawing_character

Box-drawing characters are done for the `TableStyle`; use them!

Result:

![screenshot from 2017-12-04 17-09-56](https://user-images.githubusercontent.com/4578773/33540267-0e4052fe-d916-11e7-8401-eb3be59e8025.png)

Commits
-------

360a984 Add box style table
@maidmaid maidmaid deleted the console-box-table branch December 12, 2017 01:15
symfony-splitter pushed a commit to symfony/console that referenced this pull request Mar 17, 2018
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Console] Make pretty the `box` style table

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | /
| License       | MIT
| Doc PR        | /

The console component is the 2nd most popular Symfony component with 70M of downloads. I think such composant has to provide faultless tables, with perfect management of borders, especially since the new `box` style table has been merged (cf symfony/symfony#25301).

![screenshot from 2017-12-12 18-47-34](https://user-images.githubusercontent.com/4578773/33876488-6e1dc81c-df71-11e7-924f-d5e8078d957f.png)

Commits
-------

41f52b3a09 Make pretty the `box` style table
fabpot added a commit that referenced this pull request Mar 17, 2018
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Console] Make pretty the `box` style table

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | /
| License       | MIT
| Doc PR        | /

The console component is the 2nd most popular Symfony component with 70M of downloads. I think such composant has to provide faultless tables, with perfect management of borders, especially since the new `box` style table has been merged (cf #25301).

![screenshot from 2017-12-12 18-47-34](https://user-images.githubusercontent.com/4578773/33876488-6e1dc81c-df71-11e7-924f-d5e8078d957f.png)

Commits
-------

41f52b3 Make pretty the `box` style table
@fabpot fabpot mentioned this pull request May 7, 2018
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.

None yet

6 participants