Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 08f92d4

Browse filesBrowse files
committed
[console] Adding information about coloring console output
1 parent 5fa647a commit 08f92d4
Copy full SHA for 08f92d4

File tree

Expand file treeCollapse file tree

1 file changed

+19
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+19
-1
lines changed

‎cookbook/console.rst

Copy file name to clipboardExpand all lines: cookbook/console.rst
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ This prints::
7575

7676
HELLO FABIEN
7777

78+
Coloring the Output
79+
~~~~~~~~~~~~~~~~~~~
80+
81+
Whenever you output text, you can surround the text with tags to color its
82+
output. For example::
83+
84+
// green text
85+
$output->writeln('<info>foo</info>');
86+
87+
// yellow text
88+
$output->writeln('<comment>foo</comment>');
89+
90+
// black text on a cyan background
91+
$output->writeln('<question>foo</question>');
92+
93+
// white text on a red background
94+
$output->writeln('<error>foo</error>');
95+
7896
Using Command Arguments
7997
-----------------------
8098

@@ -164,7 +182,7 @@ to confirm an action before actually executing it. Add the following to your
164182
command::
165183

166184
$dialog = $this->getHelperSet()->get('dialog');
167-
if (!$dialog->askConfirmation($output, 'Continue with this action?', false)) {
185+
if (!$dialog->askConfirmation($output, '<question>Continue with this action?</question>', false)) {
168186
return;
169187
}
170188

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.