Skip to content

Switch to martinohmann difflib fork and colorize diff output #423

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kpengboy
Copy link
Contributor

This would at least be a partial solution to #371.

I did not add the colorization to the cfgtest output, but I wonder if I should.

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 54.51%. Comparing base (6b9e153) to head (f3f1624).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
internal/engine/label/diff.go 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #423      +/-   ##
==========================================
- Coverage   54.52%   54.51%   -0.01%     
==========================================
  Files          53       53              
  Lines        4457     4459       +2     
==========================================
+ Hits         2430     2431       +1     
- Misses       1886     1887       +1     
  Partials      141      141              

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

Copy link
Contributor

github-actions bot commented Mar 2, 2025

This pull request is stale because it has been open for 30 days without activity.
This will be closed in 7 days, unless you add the 'lifecycle/keep-alive' label or comment.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity, has become stale and will be auto-closed. label Mar 2, 2025
@kpengboy
Copy link
Contributor Author

kpengboy commented Mar 9, 2025

keepalive

@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity, has become stale and will be auto-closed. label Mar 10, 2025
Add a --color flag to the apply, diff and edit commands to control
whether to output color. Valid options are "auto" and "never". (The
martinohmann/difflib library doesn't seem to support forcing color
output unfortunately.)
Copy link
Owner

@mbrt mbrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks! I can't immediately see why, but I tested manually, and it looks like gmailctl diff --color=never still colorizes the output. Could you double-check? Maybe I'm missing something.

@kpengboy
Copy link
Contributor Author

kpengboy commented May 8, 2025

Sorry about that. I fixed it so label diffs respect --color too.

Also, would you want a --color=always option to be implemented? If so we would have to implement the colorization logic ourselves instead of using the martinohmann difflib fork, but it doesn't seem very complicated to do

@mbrt
Copy link
Owner

mbrt commented May 12, 2025

@kpengboy I think this looks good enough, thanks!
Could you please rebase, resolve the conflicts and fix the tests? After that we can merge

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