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 ebe8775

Browse filesBrowse files
committed
minor #5545 Misc. improvements in the Console component introduction (javiereguiluz)
This PR was squashed before being merged into the 2.3 branch (closes #5545). Discussion ---------- Misc. improvements in the Console component introduction | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | - Commits ------- 40eb0bd Misc. improvements in the Console component introduction
2 parents 8f5338d + 40eb0bd commit ebe8775
Copy full SHA for ebe8775

File tree

Expand file treeCollapse file tree

1 file changed

+27
-20
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+27
-20
lines changed

‎components/console/introduction.rst

Copy file name to clipboardExpand all lines: components/console/introduction.rst
+27-20Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ output. For example::
140140
// white text on a red background
141141
$output->writeln('<error>foo</error>');
142142

143+
The closing tag can be replaced by ``</>``, which revokes all formatting options
144+
established by the last opened tag.
145+
143146
It is possible to define your own styles using the class
144147
:class:`Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle`::
145148

@@ -148,23 +151,27 @@ It is possible to define your own styles using the class
148151
// ...
149152
$style = new OutputFormatterStyle('red', 'yellow', array('bold', 'blink'));
150153
$output->getFormatter()->setStyle('fire', $style);
151-
$output->writeln('<fire>foo</fire>');
154+
$output->writeln('<fire>foo</>');
152155

153156
Available foreground and background colors are: ``black``, ``red``, ``green``,
154157
``yellow``, ``blue``, ``magenta``, ``cyan`` and ``white``.
155158

156-
And available options are: ``bold``, ``underscore``, ``blink``, ``reverse`` and ``conceal``.
159+
And available options are: ``bold``, ``underscore``, ``blink``, ``reverse``
160+
(enables the "reverse video" mode where the background and foreground colors
161+
are swapped) and ``conceal`` (sets the foreground color to transparent, making
162+
the typed text invisible - although it can be selected and copied; this option is
163+
commonly used when asking the user to type sensitive information).
157164

158165
You can also set these colors and options inside the tagname::
159166

160167
// green text
161-
$output->writeln('<fg=green>foo</fg=green>');
168+
$output->writeln('<fg=green>foo</>');
162169

163170
// black text on a cyan background
164-
$output->writeln('<fg=black;bg=cyan>foo</fg=black;bg=cyan>');
171+
$output->writeln('<fg=black;bg=cyan>foo</>');
165172

166173
// bold text on a yellow background
167-
$output->writeln('<bg=yellow;options=bold>foo</bg=yellow;options=bold>');
174+
$output->writeln('<bg=yellow;options=bold>foo</>');
168175

169176
Verbosity Levels
170177
~~~~~~~~~~~~~~~~
@@ -261,15 +268,15 @@ You can access the ``names`` argument as an array::
261268
$text .= ' '.implode(', ', $names);
262269
}
263270

264-
There are 3 argument variants you can use:
271+
There are three argument variants you can use:
265272

266-
=========================== ===============================================================================================================
273+
=========================== ===========================================================================================================
267274
Mode Value
268-
=========================== ===============================================================================================================
269-
InputArgument::REQUIRED The argument is required
270-
InputArgument::OPTIONAL The argument is optional and therefore can be omitted
271-
InputArgument::IS_ARRAY The argument can contain an indefinite number of arguments and must be used at the end of the argument list
272-
=========================== ===============================================================================================================
275+
=========================== ===========================================================================================================
276+
``InputArgument::REQUIRED`` The argument is required
277+
``InputArgument::OPTIONAL`` The argument is optional and therefore can be omitted
278+
``InputArgument::IS_ARRAY`` The argument can contain an indefinite number of arguments and must be used at the end of the argument list
279+
=========================== ===========================================================================================================
273280

274281
You can combine ``IS_ARRAY`` with ``REQUIRED`` and ``OPTIONAL`` like this::
275282

@@ -342,14 +349,14 @@ will work:
342349
343350
There are 4 option variants you can use:
344351

345-
=========================== =====================================================================================
346-
Option Value
347-
=========================== =====================================================================================
348-
InputOption::VALUE_IS_ARRAY This option accepts multiple values (e.g. ``--dir=/foo --dir=/bar``)
349-
InputOption::VALUE_NONE Do not accept input for this option (e.g. ``--yell``)
350-
InputOption::VALUE_REQUIRED This value is required (e.g. ``--iterations=5``), the option itself is still optional
351-
InputOption::VALUE_OPTIONAL This option may or may not have a value (e.g. ``--yell`` or ``--yell=loud``)
352-
=========================== =====================================================================================
352+
=============================== =====================================================================================
353+
Option Value
354+
=============================== =====================================================================================
355+
``InputOption::VALUE_IS_ARRAY`` This option accepts multiple values (e.g. ``--dir=/foo --dir=/bar``)
356+
``InputOption::VALUE_NONE`` Do not accept input for this option (e.g. ``--yell``)
357+
``InputOption::VALUE_REQUIRED`` This value is required (e.g. ``--iterations=5``), the option itself is still optional
358+
``InputOption::VALUE_OPTIONAL`` This option may or may not have a value (e.g. ``--yell`` or ``--yell=loud``)
359+
=============================== =====================================================================================
353360

354361
You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or ``VALUE_OPTIONAL`` like this:
355362

0 commit comments

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