Skip to content

Color text only when the Stdout FD indicates the Terminal#2

Merged
mdm-code merged 6 commits intomainfrom
detect-tty
Sep 24, 2023
Merged

Color text only when the Stdout FD indicates the Terminal#2
mdm-code merged 6 commits intomainfrom
detect-tty

Conversation

@mdm-code
Copy link
Copy Markdown
Owner

  • Add the Term package to the project
  • Add colorize parameter to the pipe function
  • Parametrize colorize depending if it is tty
  • Adjust unit tests for the pipe function
  • The term package is now used directly
  • Include function documentation for pipe fn

It defaults to true as for now.
When output is written to an fd that's stdin
of another process it's not going to be colorized.
It now uses the colorize parameter according
to its new signature.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 24, 2023

Codecov Report

Patch coverage: 78.57% and project coverage change: -2.21% ⚠️

Comparison is base (47045cb) 92.54% compared to head (9f04400) 90.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #2      +/-   ##
==========================================
- Coverage   92.54%   90.33%   -2.21%     
==========================================
  Files           3        3              
  Lines         228      238      +10     
==========================================
+ Hits          211      215       +4     
- Misses         13       17       +4     
- Partials        4        6       +2     
Files Changed Coverage Δ
cmd/tcols/main.go 80.50% <78.57%> (-3.76%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mdm-code mdm-code self-assigned this Sep 24, 2023
@mdm-code mdm-code merged commit aee6038 into main Sep 24, 2023
@mdm-code mdm-code deleted the detect-tty branch September 24, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants