Skip to content

Commit 362d2b6

Browse files
authored
Merge pull request #7855 from cakephp/banner-helper
Add docs for the banner helper
2 parents f455951 + d23c34f commit 362d2b6

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

en/appendices/5-1-migration-guide.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ Command
5252
- ``bin/cake plugin list`` has been added to list all available plugins,
5353
their load configuration and version.
5454
- Optional ``Command`` arguments can now have a ``default`` value.
55+
- ``BannerHelper`` was added. This command helper can format text as a banner
56+
with a coloured background and padding.
57+
- Additional default styles for ``info.bg``, ``warning.bg``, ``error.bg`` and
58+
``success.bg`` were added to ``ConsoleOutput``.
5559

5660
Console
5761
-------

en/console-commands/input-output.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,19 @@ progress bar as necessary::
148148
$progress->increment(4);
149149
$progress->draw();
150150

151+
Banner Helper
152+
-------------
153+
154+
The ``BannerHelper`` can be used to format one or more lines of text into
155+
a banner with a background and horizontal padding::
156+
157+
$io->helper('Banner')
158+
->withPadding(5)
159+
->withStyle('success.bg')
160+
->output(['Work complete']);
161+
162+
.. versionadded:: 5.1.0
163+
The ``BannerHelper`` was added in 5.1
151164

152165
Getting User Input
153166
==================
@@ -300,6 +313,10 @@ are several built-in styles, and you can create more. The built-in ones are
300313
* ``info`` Informational messages. Cyan text.
301314
* ``comment`` Additional text. Blue text.
302315
* ``question`` Text that is a question, added automatically by shell.
316+
* ``info.bg`` White background with cyan text.
317+
* ``warning.bg`` Yellow background with black text.
318+
* ``error.bg`` Red background with black text.
319+
* ``success.bg`` Green background with black text.
303320

304321
You can create additional styles using ``$io->setStyle()``. To declare a
305322
new output style you could do::
@@ -332,6 +349,9 @@ truthy value enables them.
332349
Adding a style makes it available on all instances of ConsoleOutput as well,
333350
so you don't have to redeclare styles for both stdout and stderr objects.
334351

352+
.. versionchanged:: 5.1.0
353+
The ``info.bg``, ``warning.bg``, ``error.bg``, and ``success.bg`` were added.
354+
335355
Turning Off Coloring
336356
====================
337357

0 commit comments

Comments
 (0)