ponylang / peg

:horse: A parsing expression grammar package for Pony
BSD 2-Clause "Simplified" License
16 stars 6 forks source link

Add support for not outputting color to terminal #44

Closed greenfork closed 8 months ago

greenfork commented 8 months ago

This is required when the output is piped into a file or a program.

Here is a more general approach via an environment variable NO_COLOR https://no-color.org/. I decided to only include a boolean option since this function is exposed for user code and not internal to the package.

ponylang-main commented 8 months ago

Hi @greenfork,

The changelog - added label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do.

Release notes are added by creating a uniquely named file in the .release-notes directory. We suggest you call the file 44.md to match the number of this pull request.

The basic format of the release notes (using markdown) should be:

## Title

End user description of changes, why it's important,
problems it solves etc.

If a breaking change, make sure to include 1 or more
examples what code would look like prior to this change
and how to update it to work after this change.

Thanks.

SeanTAllen commented 8 months ago

I have a slight preference here towards having the option be an affirmative "colorize" that defaults to true and would end up as else "".

@jemc thoughts?

SeanTAllen commented 8 months ago

@greenfork i'm going to switch this to a draft until this is finalized (so it can't be accidentally merged). unfortunately due to the holidays, that is going to be a couple weeks for larger feedback.

greenfork commented 8 months ago

I like the affirmative boolean too. I'm not in a rush, thanks for telling about it. Happy holidays! I will proceed and apply your suggestion. I thought about naming it colored but colorize I think is even better.