-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow user to force syntax highlighting using config file, env var or command line. Enable syntax highlighting in GitHub Action. #353
Conversation
It works in akaihola/pgtricks#18! |
@mayk0gan, good news, you can see syntax highlighting in action for Darker output in akaihola/pgtricks build #24 (see screenshot in earlier comment). Could you review this pull request and approve it for merging if it looks good to you? |
Looking for a reviewer for this, pinging contributors previously interested in the GitHub Action: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should allow true
and false
for color.
The environment variable `PY_COLORS` overrides `color =` from `pyproject.toml`, and the command line options override both of those.
This helps in testing feature branches like this one in actual GitHub workflows of other repositories.
Thanks @roniemartinez Co-authored-by: Ronie Martinez <ronmarti18@gmail.com>
So lower case `true` and `false`.
If `pygments` isn't installed, highlighting should never be used. So these test cases can be easily parameterized as a test matrix. Also simplified the other half of `should_use_color()` tests a bit.
Thanks @MatthijsBurgh! Co-authored-by: Matthijs van der Burgh <MatthijsBurgh@outlook.com>
By default, highlighting is now enabled if outputting to a terminal and
pygments
is installed.Highlighting can now be force enabled for non-terminal output or force disabled for terminal output using:
color = {true|false}
inpyproject.toml
,PY_COLORS={0|1}
environment variables (overridespyproject.toml
), or--color
/--no-color
command line options (override bothpyproject.toml
and the environment variable)Remaining tasks:
--color
by default in the GitHub ActionNO_COLOR
environment variable #355, or to postpone this for 1.5.1 (see discussion)Fixes #263.
See also #355 as a follow-up issue (possible support for the
NO_COLOR
environment variable).