From c9d37bf0e75d840d9d1dc4f4db6067011471f4fc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 21 Jul 2015 13:18:00 +0200 Subject: [PATCH 1/3] Misc. improvements in the Console component introduction --- components/console/introduction.rst | 46 ++++++++++++++++------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 81229476e8f..53602db89d1 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -140,6 +140,9 @@ output. For example:: // white text on a red background $output->writeln('foo'); +The closing tag can be replaced by just ````. This makes the component to +stop applying any style defined by the immediately previous open tag. + It is possible to define your own styles using the class :class:`Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle`:: @@ -148,23 +151,26 @@ It is possible to define your own styles using the class // ... $style = new OutputFormatterStyle('red', 'yellow', array('bold', 'blink')); $output->getFormatter()->setStyle('fire', $style); - $output->writeln('foo'); + $output->writeln('foo'); Available foreground and background colors are: ``black``, ``red``, ``green``, ``yellow``, ``blue``, ``magenta``, ``cyan`` and ``white``. -And available options are: ``bold``, ``underscore``, ``blink``, ``reverse`` and ``conceal``. +And available options are: ``bold``, ``underscore``, ``blink``, ``reverse`` +(enables the "reverse video" mode where the background and foreground colors +are swapped) and ``conceal`` (the text will be hidden; commonly used to ask +the user to type sensitive information). You can also set these colors and options inside the tagname:: // green text - $output->writeln('foo'); + $output->writeln('foo'); // black text on a cyan background - $output->writeln('foo'); + $output->writeln('foo'); // bold text on a yellow background - $output->writeln('foo'); + $output->writeln('foo'); Verbosity Levels ~~~~~~~~~~~~~~~~ @@ -261,15 +267,15 @@ You can access the ``names`` argument as an array:: $text .= ' '.implode(', ', $names); } -There are 3 argument variants you can use: +There are three argument variants you can use: -=========================== =============================================================================================================== +=========================== =========================================================================================================== Mode Value -=========================== =============================================================================================================== -InputArgument::REQUIRED The argument is required -InputArgument::OPTIONAL The argument is optional and therefore can be omitted -InputArgument::IS_ARRAY The argument can contain an indefinite number of arguments and must be used at the end of the argument list -=========================== =============================================================================================================== +=========================== =========================================================================================================== +``InputArgument::REQUIRED`` The argument is required +``InputArgument::OPTIONAL`` The argument is optional and therefore can be omitted +``InputArgument::IS_ARRAY`` The argument can contain an indefinite number of arguments and must be used at the end of the argument list +=========================== =========================================================================================================== You can combine ``IS_ARRAY`` with ``REQUIRED`` and ``OPTIONAL`` like this:: @@ -342,14 +348,14 @@ will work: There are 4 option variants you can use: -=========================== ===================================================================================== -Option Value -=========================== ===================================================================================== -InputOption::VALUE_IS_ARRAY This option accepts multiple values (e.g. ``--dir=/foo --dir=/bar``) -InputOption::VALUE_NONE Do not accept input for this option (e.g. ``--yell``) -InputOption::VALUE_REQUIRED This value is required (e.g. ``--iterations=5``), the option itself is still optional -InputOption::VALUE_OPTIONAL This option may or may not have a value (e.g. ``--yell`` or ``--yell=loud``) -=========================== ===================================================================================== +=============================== ===================================================================================== +Option Value +=============================== ===================================================================================== +``InputOption::VALUE_IS_ARRAY`` This option accepts multiple values (e.g. ``--dir=/foo --dir=/bar``) +``InputOption::VALUE_NONE`` Do not accept input for this option (e.g. ``--yell``) +``InputOption::VALUE_REQUIRED`` This value is required (e.g. ``--iterations=5``), the option itself is still optional +``InputOption::VALUE_OPTIONAL`` This option may or may not have a value (e.g. ``--yell`` or ``--yell=loud``) +=============================== ===================================================================================== You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or ``VALUE_OPTIONAL`` like this: From 76ebd40aa3997b76eaf3f7b22a76aa4e13351048 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 21 Jul 2015 22:33:18 +0200 Subject: [PATCH 2/3] Reworded the explanation of the short closing tag --- components/console/introduction.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 53602db89d1..61538562fb7 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -140,8 +140,8 @@ output. For example:: // white text on a red background $output->writeln('foo'); -The closing tag can be replaced by just ````. This makes the component to -stop applying any style defined by the immediately previous open tag. +The closing tag can be replaced by ```` which revokes all formatting options +established by the last opened tag. It is possible to define your own styles using the class :class:`Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle`:: From d69fe491078d579f766aac020ef998fade0eee4e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 23 Jul 2015 16:01:48 +0200 Subject: [PATCH 3/3] Reworded the explanation about "conceal" option --- components/console/introduction.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 61538562fb7..ad772247b62 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -140,7 +140,7 @@ output. For example:: // white text on a red background $output->writeln('foo'); -The closing tag can be replaced by ```` which revokes all formatting options +The closing tag can be replaced by ````, which revokes all formatting options established by the last opened tag. It is possible to define your own styles using the class @@ -158,8 +158,9 @@ Available foreground and background colors are: ``black``, ``red``, ``green``, And available options are: ``bold``, ``underscore``, ``blink``, ``reverse`` (enables the "reverse video" mode where the background and foreground colors -are swapped) and ``conceal`` (the text will be hidden; commonly used to ask -the user to type sensitive information). +are swapped) and ``conceal`` (sets the foreground color to transparent, making +the typed text invisible - although it can be selected and copied; this option is +commonly used when asking the user to type sensitive information). You can also set these colors and options inside the tagname::