ocaml-semver / ocaml-api-watch

Libraries and tools to keep watch on you OCaml lib's API changes
ISC License
21 stars 15 forks source link

Display value diffs as text diffs #57

Closed NathanReb closed 4 months ago

NathanReb commented 5 months ago

Before diving deeper in the range of changes we can properly detect, it would be good to be able to display the changes we already detect.

We now have a basic representation of changes to values. We would like to be able to pretty print such changes in a text diff-like format for human consumption.

The goal here is to add functions to the library that can print our diff as a text diff and to update the binary diff tool so that it outputs such diffs instead of simply printing API changed!.

NathanReb commented 5 months ago

Might be worth looking at https://github.com/panglesd/ocaml-diffutils, could be useful to turn our diff into their Diff.t and let them handle the printing!

CC @panglesd, do you think it could fit our usecase?

NathanReb commented 5 months ago

CC @Siddhi-agg

Siddhi-agg commented 5 months ago

@NathanReb Please assign me. If integrating with ocaml-diffutils is possible, that would be great!

panglesd commented 4 months ago

I only see now that I completely missed the ping, sorry! (I think I was on vacation at the time, it must have been list in the sea of notification when I returned).

Using ocaml-diffutils for handling the printing could make sense, although I believe it will be limited for your usecase whenever you will go fancy!

You might want to have a look at diffcessible which show diffs as a TUI.

(Both of these libraries are focused on showing text diffs (with numbered lines). So they might not be suitable be we are open to making them suitable to other contexts, eg where line numbers/filenames do not make sense!)