ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Option to custom style the output of the WP-CLI messages

Open dingo-d opened this issue 3 years ago • 3 comments

Feature Request

Describe your use case and the problem you are facing

A lot of modern tooling (especially in Laravel space) have really pretty looking CLI outputs (mostly thanks to https://github.com/nunomaduro/termwind).

Using Termwind would be great, and could probably be used with WP-CLI, if it wasn't locked to PHP 8.

So the alternative is to have the output of the WP-CLI a bit more customizable. Increasing line height, making some other modifications to the output, etc.

Some styling is possible now, but that's not much.

Describe the solution you'd like

Currently, for instance, the WP_CLI::success method only has one parameter $message. Other commands such as error, line or log could have a second optional parameter $style where these parameters could be added as an array of items:

WP_CLI::success($message,
  [
    'color' => '#FEFEFE',
    'background' => 'green',
    'line-height' => '1.5',
    'style' => 'italic',
    'weight' => 'bold'
  ]
);

dingo-d avatar Jul 05 '22 07:07 dingo-d

I think I'd much prefer adopting Termwind, vs. inventing our own version 😁

This might be a good candidate for a WP-CLI v3.0

danielbachhuber avatar Jul 20 '22 14:07 danielbachhuber

So WP-CLI v3.0 would then be locked to PHP 8? 😅

dingo-d avatar Jul 20 '22 14:07 dingo-d

So WP-CLI v3.0 would then be locked to PHP 8? 😅

Probably not going to happen but one can wish 😁

danielbachhuber avatar Jul 20 '22 14:07 danielbachhuber