Skip to content

Commit adfe2d2

Browse files
committed
Reword
1 parent 4a3d165 commit adfe2d2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

console/style.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,38 @@ Result Methods
412412
'Consectetur adipiscing elit',
413413
]);
414414

415+
Configuring the Default Styles
416+
------------------------------
417+
418+
By default, Symfony Styles wrap all contents to avoid having lines of text that
419+
are too long. The only exception is URLs, which are not wrapped, no matter how
420+
long they are. This is done to enable clickable URLs in terminals that support them.
421+
422+
If you prefer to wrap all contents, including URLs, use this method::
423+
424+
// src/Command/GreetCommand.php
425+
namespace App\Command;
426+
427+
// ...
428+
use Symfony\Component\Console\Style\SymfonyStyle;
429+
430+
class GreetCommand extends Command
431+
{
432+
// ...
433+
434+
protected function execute(InputInterface $input, OutputInterface $output): int
435+
{
436+
$io = new SymfonyStyle($input, $output);
437+
$io->getOutputWrapper()->setAllowCutUrls(true);
438+
439+
// ...
440+
}
441+
}
442+
443+
.. versionadded:: 6.2
444+
445+
The ``setAllowCutUrls()`` method was introduced in Symfony 6.2.
446+
415447
Defining your Own Styles
416448
------------------------
417449

0 commit comments

Comments
 (0)