feat(api): Group commands by openapi tag #131
Merged
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 recently added support for command groups.
I have used it for 2 things:
help
andcompletion
. They can be put in thegeneric
group, but I quite liked that they ended up underAdditional Commands
Example
Because a command can have multiple tags, but only 1 group, I'm just selecting the first tag. A bit of a spot check for APIs in the wild seems to indicate that most APIs use tags in this way. APIs which do not have any groups will have their restish command list render exactly the same way
Example:
It looks a bit overkill on the example, but we have multiple APIs with over 25 commands each, and the grouping really helps there.
If this is deemed to invasive, I'm happy to investigate and contribute an api level config option for this behaviour.