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

Skip to content

Commit 418d012

Browse files
committed
feature #14196 Tweaked some console command styles (javiereguiluz)
This PR was squashed before being merged into the 2.7 branch (closes #14196). Discussion ---------- Tweaked some console command styles | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14174 | License | MIT | Doc PR | - As discussed, after updating the first console commands to the new style guide, we were going to introduce the needed tweaks. This PR is the first one with those tweaks. ### Tables Headers now are displayed in the usual green color used frequently by Symfony commands: ![table_header](https://cloud.githubusercontent.com/assets/73419/6980286/a126e8cc-d9ef-11e4-8d1e-9a5be21564eb.png) ### Command tiles and section titles I see these titles in a beautiful blue color ... but lots of people use color schemes which make them almost unreadable. Now they use the yellow color frequently used by Symfony commands: ![command_section_titles](https://cloud.githubusercontent.com/assets/73419/6980292/b499627c-d9ef-11e4-9940-e134ee0eb02f.png) ### Listings Elements in a listing no longer add an extra blank line. See #14174 for the rationale. Commits ------- dcf1801 Tweaked some console command styles
2 parents aae98a9 + dcf1801 commit 418d012

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ public function block($messages, $type = null, $style = null, $prefix = ' ', $pa
9797
*/
9898
public function title($message)
9999
{
100-
$this->writeln(sprintf("\n<fg=blue>%s</fg=blue>\n<fg=blue>%s</fg=blue>\n", $message, str_repeat('=', strlen($message))));
100+
$this->writeln(sprintf("\n<comment>%s</>\n<comment>%s</>\n", $message, str_repeat('=', strlen($message))));
101101
}
102102

103103
/**
104104
* {@inheritdoc}
105105
*/
106106
public function section($message)
107107
{
108-
$this->writeln(sprintf("<fg=blue>%s</fg=blue>\n<fg=blue>%s</fg=blue>\n", $message, str_repeat('-', strlen($message))));
108+
$this->writeln(sprintf("<comment>%s</>\n<comment>%s</>\n", $message, str_repeat('-', strlen($message))));
109109
}
110110

111111
/**
@@ -119,7 +119,7 @@ public function listing(array $elements)
119119
$elements
120120
);
121121

122-
$this->writeln(implode("\n\n", $elements)."\n");
122+
$this->writeln(implode("\n", $elements)."\n");
123123
}
124124

125125
/**
@@ -183,6 +183,8 @@ public function caution($message)
183183
*/
184184
public function table(array $headers, array $rows)
185185
{
186+
$headers = array_map(function ($value) { return sprintf('<info>%s</>', $value); }, $headers);
187+
186188
$table = new Table($this);
187189
$table->setHeaders($headers);
188190
$table->setRows($rows);

0 commit comments

Comments
 (0)