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

Skip to content

Commit 8a12eb3

Browse files
committed
feature #25301 [Console] Add box style table (maidmaid)
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
2 parents 721d370 + 360a984 commit 8a12eb3

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Symfony/Component/Console/Helper/Table.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,18 @@ private static function initStyles()
637637
->setCellHeaderFormat('%s')
638638
;
639639

640+
$box = (new TableStyle())
641+
->setHorizontalBorderChar('')
642+
->setVerticalBorderChar('')
643+
->setCrossingChar('')
644+
;
645+
640646
return array(
641647
'default' => new TableStyle(),
642648
'borderless' => $borderless,
643649
'compact' => $compact,
644650
'symfony-style-guide' => $styleGuide,
651+
'box' => $box,
645652
);
646653
}
647654

src/Symfony/Component/Console/Tests/Helper/TableTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,22 @@ public function renderProvider()
136136
80-902734-1-6 And Then There Were None Agatha Christie
137137
=============== ========================== ==================
138138

139+
TABLE
140+
),
141+
array(
142+
array('ISBN', 'Title', 'Author'),
143+
$books,
144+
'box',
145+
<<<'TABLE'
146+
┼───────────────┼──────────────────────────┼──────────────────┼
147+
│ ISBN │ Title │ Author │
148+
┼───────────────┼──────────────────────────┼──────────────────┼
149+
│ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri │
150+
│ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens │
151+
│ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien │
152+
│ 80-902734-1-6 │ And Then There Were None │ Agatha Christie │
153+
┼───────────────┼──────────────────────────┼──────────────────┼
154+
139155
TABLE
140156
),
141157
array(

0 commit comments

Comments
 (0)