chshersh / iris

🌈 Haskell CLI Framework supporting Command Line Interface Guidelines
https://hackage.haskell.org/package/iris
Mozilla Public License 2.0
177 stars 22 forks source link

Add CLI options to handle colouring #22

Closed chshersh closed 1 year ago

chshersh commented 2 years ago

Currently, Iris checks stdout and stderr handles to decide whether they support colouring or not. And that's all. This issue is about improving the detection of colouring via CLI options.

Description

Following CLI Guidelines, the new logic for detecting colouring should be as follows:

Additionally, Iris should provide the --color option (with the --colour option as well being hidden via internal) with the following values:

Implementation

marcellourbani commented 1 year ago

I'll have a go

marcellourbani commented 1 year ago

@chshersh I'm a bit confused by strings:

As I understand the former is about output and the latter about command line parsing, so they will probably coexist smoothly, but still feels a bit odd

Is this deliberate?

chshersh commented 1 year ago

Since text-2.0, Text is now a UTF-8 array of bytes. I'd love to move the entire API towards Text for consistency so yes, the existing situation around having both ByteString and Text is a bit unfortunately 😞

If you feel like it, you can create a separate issue to change types in Iris.Colour.Formatting from ByteString to Text and work on it separately. It'll be a breaking change but that's okay at this stage.