Skip to content
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

Add no_color and force_color parameters to override env vars #38

Merged
merged 1 commit into from
Apr 23, 2023

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Jan 14, 2023

Fixes #33, #28 (comment), #2 (comment).

https://no-color.org/ says (command-line) arguments should override the environment variables:

  1. How should configuration files and command-line arguments be processed in the presence of $NO_COLOR?

User-level configuration files and per-instance command-line arguments should override $NO_COLOR. A user should be able to export $NO_COLOR in their shell configuration file as a default, but configure a specific program in its configuration file to specifically enable color.

This also means that software that can add color but doesn’t by default does not need to care about $NO_COLOR, because it will only ever be adding color when instructed to do so (as it should be).

Add both no_color and force_color parameters.

The no_color parameter takes priority over force_color, and both parameters take priority over the environment variables.

@hugovk hugovk added the changelog: Added For new features label Jan 14, 2023
@codecov
Copy link

codecov bot commented Jan 14, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (35a885d) compared to base (fd27ce2).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #38   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          105       115   +10     
=========================================
+ Hits           105       115   +10     
Flag Coverage Δ
macos-latest 100.00% <100.00%> (ø)
ubuntu-latest 100.00% <100.00%> (ø)
windows-latest 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/termcolor/termcolor.py 100.00% <100.00%> (ø)
tests/test_termcolor.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@hugovk hugovk merged commit 0e016d9 into termcolor:main Apr 23, 2023
@hugovk hugovk deleted the override-env-vars branch April 23, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Added For new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request: force colours
1 participant