New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Cobra and make use of its new command grouping #6589
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.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed in sync


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