CLI Quiet Mode and Custom Progress Writer #246
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for custom progress writers, allowing consumers of the Go package to implement their own progress reporting while maintaining full backward compatibility.
A new (global)
--quietflag that will silence verbose output as discussed in #117One of my use-cases is to use the
go-pmtilespackage in an automated extract generating service. Right now I have some hacky code to parse the ASCII progressbar and convert that into a data structure that I can use to monitor and track extract progress.API Changes
New Public Functions
Breaking Changes
None. This is purely additive - all existing code continues to work unchanged.
Future work
#117 also mentions
slogwhich would be a nice change, however to implement this cleanly the public APIs would need to change from accepting anlog.Loggerto anslog.Logger. I chose not to include that in this PR to avoid making any breaking public API changes. There are ways to wrap and overridelog.Loggerto not break the API, but I didn't want to go down that (messy) path without maintainer encouragement.Overall there's a lot of CLI-like logic that could be pulled out of
pmtiles/into themain.goCLI that would improve thego-pmtilespackage ergonomics. The progress writer felt like a good place to start. The next one that would be useful to me is theShow()API, to programmatically get a struct of metadata.