Repository navigation
Update Cobra and make use of its new command grouping - #6589
Merged
Merged
Conversation
Setting GH_COBRA allows access to Cobra's built-in implementation of generating man pages and markdown trees. This is useful for testing and comparing our overrides against Cobra's own logic.
|
we may get away using handcrafted shell completion to get a better user experience, I have experimented a bit with completion and gh, here is a wrapper around "gh issue create" to complete owner/repo with assignee bug and label coming from the owner/repo. (wrapper, and completion) demo: Screen.Recording.2022-11-29.at.08.42.22.movI don't think with cobra we could inject some context and completion depending of previous arguments.. |
Contributor
Author
samcoe
approved these changes
Dec 5, 2022
samcoe
left a comment
Contributor
There was a problem hiding this comment.
Code LGTM. I like the idea proposed offline of targeted vs general commands. Since that would require changing many more commands perhaps we should push that to another PR? Up to you though.
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.
Cobra 1.6 supports command grouping natively.
Apart from grouping on the root command, arbitrary grouping is now supported at any level. As an experiment, this PR introduces grouping on the
gh issuelevel:The idea is to group together "general" issue commands, i.e. those that do not operate on any specific issue, vs. those that need an issue argument. Although, I'm not still happy with group names. Any better suggestions?
Bonus for testing: since we completely override so many of Cobra's features, I thought it would be nice to be able to temporarily restore Cobra default behaviors for comparison, so this introduces the GH_COBRA environment variable for testing. When set, Cobra reverts to its out-of-the-box settings:
Fixes #6523