plantain-00 / type-coverage

A CLI tool to check type coverage for typescript code
MIT License
1.26k stars 44 forks source link

feat(cli): add colors output option #139

Closed Jayllyz closed 6 months ago

Jayllyz commented 6 months ago

Changes :

Added color output options, --color to force colors, or --no-color to disable them.

The Chalk library also uses environment variables such as FORCE_COLOR to enable/disable color output.

Please let me know if I've made any mistakes, as this is my first contribution to this project.

Preview: image image

Fixes(if relevant):

Checks

plantain-00 commented 6 months ago

It seems one option(rather than two --color and --no-color) is enough for this feature. I suggest it enabled by default and --no-color to disable it.

Jayllyz commented 6 months ago

Hello, It seems that chalk implements --color and --no-color automatically, so I could delete what I did in index except the part where I set color in printOutput. I don't know how to force the default color since chalk detects itself if the terminal is tty. What do you suggest?

I also need to update the readme, should I do it here or in another PR?

plantain-00 commented 6 months ago

"Just set color in printOutput" is acceptable to me.

You can add some descriptions in Readme.md FAQ part, for example:

> Q: How to disable color in output?

Set the environment variable `FORCE_COLOR=0`, See <https://github.com/chalk/chalk?tab=readme-ov-file#supportscolor> for details.