[Proposal] Use annotation-based daemon skip for cobra commands#413
Draft
inFocus7 wants to merge 2 commits intoagentregistry-dev:mainfrom
Draft
[Proposal] Use annotation-based daemon skip for cobra commands#413inFocus7 wants to merge 2 commits intoagentregistry-dev:mainfrom
inFocus7 wants to merge 2 commits intoagentregistry-dev:mainfrom
Conversation
Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 is a proposal, can be removed if not as helpful as I think it is 👍🏼
Description
Currently we define the set of skipped commands in an un-exported field. If anyone extends this library they won't be able to easily set up commands that don't require a daemon running. We can create extension points (exported functionality or cli option one can plug in commands), but this would be another extension point which adds complexity to the codebase.
Proposal is to move from the map-based skips to an annotation-based one. Commands would be able to define if they don't need the daemon directly in its definition through the annotation field.
Change Type
Changelog
Additional Notes
An edge case would be if commands define their own
PersistentPreRun, then the one we use now is overriden and so settingskipDaemon: trueon those commands won't have any effect. This is a pre-existing edge case, but worth noting.The root
completioncommand is from cobra, so it is the exception where we can't directly define the annotation for.