feat: Add trait for extending the cli with custom inspectors #513
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.
closes #503
This PR adds the trait
InspectorCliExt
, which allows a user to define a function that initializes and returns their custom inspectors.Future proofing the public api - In order to keep the diff small and not over engineer for a problem we don't currently have, I avoided making a super trait for all cli extensions. However I think a super trait could help reduce the churn for brontes lib consumers and it might be wise to add sooner then later. For example we could have a trait
Proposed follow ups:
.env.sample
to help people boot strap a local setup. Relates to Write documentation #205, specifically "Installation and setup instructions"Cli
struct that can wraps up the logic of callingArg::parse
andrun
, the ext trait could be an arg directly to the struct.unwraps
/expects
and it can be hard to debug. For example, the default impl for ClickHouseConfig (which is implicitly called byClickhouse::default
) will panic if certain env vars are not set, but the expect messages don't make their way to the terminal. ThisDidn't want to spam with issues, but happy to break these out if they look reasonable
TODO