Break out CLI functionality to make it modular + --line
flag
#454
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.
Here, break out the CLI so that most of its implementation no longer
lives in a
main.go
, and rather in a subpackage that can be importedfrom somewhere else. This lets the majority of it to be reused in
another executable and augmented in various ways.
An addition is a new
DriverProcurer
interface that can provide adriver for various databases:
For the main CLI, this gets a trivial implementation using
riverpgxv5
,but could potentially be reimplemented elsewhere to swap in something
else;
To make this more workable, I end up going through and refactoring quite
a lot of code, making it into a bit of a mini framework, and one that
could potentially support additional databases in the future without
having to refactor the world again.
We also add a
--line
flag to support the feature from #435 to the CLI.