sharkdp / hexyl

A command-line hex viewer
Apache License 2.0
8.92k stars 227 forks source link

Implement builder pattern #168

Closed sharifhsn closed 1 year ago

sharifhsn commented 1 year ago

As discussed in my previous pull request, this pull request deprecates using the new method directly on the Printer struct, preferring the PrinterBuilder struct for the builder pattern. This is a breaking change for hexyl as a library.

sharifhsn commented 1 year ago

Let me know if there are any bikeshed quibbles with the naming of methods and I'll be happy to change them!

sharkdp commented 1 year ago

Awesome, thank you very much!

Could you please add an entry to the "unreleased" section in CHANGELOG.md to briefly describe the breaking change? That would help me with creating the next release.

sharifhsn commented 1 year ago

One last thing: do you feel it's necessary to add documentation to the new PrinterBuilder struct? I feel like the builder functions are self-documenting, but perhaps the new function and build function should have examples for those unfamiliar with the builder pattern.

sharkdp commented 1 year ago

One last thing: do you feel it's necessary to add documentation to the new PrinterBuilder struct? I feel like the builder functions are self-documenting, but perhaps the new function and build function should have examples for those unfamiliar with the builder pattern.

Thank you for your concern. Adding documentation is always great, but I wouldn't see this as a requirement for this PR. This changeset already improves hexyl as a library significantly.

There was no documentation before because - to be honest - I only support hexyl-the-public-library in a "best effort" manner.

So I suggest we merge this as is, but new PRs are always welcome of course!

sharifhsn commented 1 year ago

That should be everything!