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

Customize the report to be html using go templates #123

Open
jlunaq opened this issue Nov 13, 2020 · 4 comments
Open

Customize the report to be html using go templates #123

jlunaq opened this issue Nov 13, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@jlunaq
Copy link

jlunaq commented Nov 13, 2020

I want to create a go script for detecting differences between yaml configurations and creating a html table with the results. Example:

deployment-1.yaml deployment-2.yaml
replicas: 0 replicas: 1
@HeavyWombat
Copy link
Member

Yes, definitely. I wrote the package in such a way that it would be possible to just use the difference detection part as a library. Besides dyff itself, there are at least two other projects I know that use it as a library. That being said, it sure could use a bit refactoring/restructuring to be a bit more convenient. Let me know if there is something unclear or could be done better.

Main entry point is: github.com/homeport/dyff/pkg/dyff.CompareInputFiles(). This takes in ytbx.InputFiles and optional compare options, for example to ignore order changes in lists. The github.com/gonvenience/ytbx.InputFile is mostly there due to the fact that you need support for files with multiple documents and different input sources (local file, remote file, or stdin). You get that with ytbx.LoadFile().

@jlunaq
Copy link
Author

jlunaq commented Nov 13, 2020

Thanks @HeavyWombat. I already looked at the tests and they give me a clue about how to use it as a library. I think I have no problem with that at all. Could you please only let me know how can I customize the report to be an html table instead?, I can be working on a fork and submit a PR if that works for you.

@jlunaq jlunaq closed this as completed Nov 17, 2020
@HeavyWombat
Copy link
Member

@jlunaq Apologies for the late reply. I am busy at the moment with a lot of things. If you do not mind, I would like to keep it open. My idea would be another reporter type, one that is using Go templates to create the report output. This way it would be generic enough to create HTML, or JSON, or Markdown style reports. However, I cannot really say when I find time for an implementation. PRs are always welcome, too.

@jlunaq
Copy link
Author

jlunaq commented Nov 17, 2020

No worries. I thought I required that feature, but my team told me it wasn't really needed. However, if I plan to implement it in the future, I will let you know. Please keep this open

@jlunaq jlunaq reopened this Nov 17, 2020
@jlunaq jlunaq changed the title Can I use this package as a library for my script? Can I customize the report to be html using go templates? Nov 17, 2020
@jlunaq jlunaq changed the title Can I customize the report to be html using go templates? Customize the report to be html using go templates Nov 17, 2020
@HeavyWombat HeavyWombat added the enhancement New feature or request label Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants