🎉
This commit is contained in:
25
vendor/laravel/prompts/src/Concerns/Termwind.php
vendored
Normal file
25
vendor/laravel/prompts/src/Concerns/Termwind.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Prompts\Concerns;
|
||||
|
||||
use Laravel\Prompts\Output\BufferedConsoleOutput;
|
||||
|
||||
use function Termwind\render;
|
||||
use function Termwind\renderUsing;
|
||||
|
||||
trait Termwind
|
||||
{
|
||||
protected function termwind(string $html)
|
||||
{
|
||||
renderUsing($output = new BufferedConsoleOutput());
|
||||
|
||||
render($html);
|
||||
|
||||
return $this->restoreEscapeSequences($output->fetch());
|
||||
}
|
||||
|
||||
protected function restoreEscapeSequences(string $string)
|
||||
{
|
||||
return preg_replace('/\[(\d+)m/', "\e[".'\1m', $string);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user