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

Colorize diffs #335

Closed
gavv opened this issue Mar 10, 2023 · 2 comments
Closed

Colorize diffs #335

gavv opened this issue Mar 10, 2023 · 2 comments
Assignees
Labels
feature New feature or request good first issue Good for newcomers help wanted Contributions are welcome
Milestone

Comments

@gavv
Copy link
Owner

gavv commented Mar 10, 2023

Follow-up for #161.

It would be nice to apply colorization when we format diffs:

  • color.FgWhite for lines starting with "---" and "+++"
  • color.FgGreen for lines starting with "+"
  • color.FgRed for lines staring with "-"
  • no color for other lines

Colorization should be implemented as a template function added to defaultTemplateFuncs, say, "colordiff", used as follows in defaultFailureTemplate:

{{ .Diff | colordiff | indent }}

This is needed because we don't want to pass colorized values to user templates, if user enabled custom templates.

Ralated: #334.

@gavv gavv added feature New feature or request help wanted Contributions are welcome good first issue Good for newcomers labels Mar 10, 2023
This was referenced Mar 10, 2023
@gpjservais
Copy link
Contributor

@gavv can I work on this one?

@gavv
Copy link
Owner Author

gavv commented Mar 10, 2023

Sure, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers help wanted Contributions are welcome
Projects
None yet
Development

No branches or pull requests

2 participants