cobra
cobra copied to clipboard
feat: add flag help groups
Description
Flags can now be split into groups in usage text:
$ root child --help
Usage:
root child [flags]
Flags:
-h, --help help for child
--i int int flag
Grouped Flags:
--b bool flag
--s string string flag
Global Flags:
--g string global flag
Related Issues
- Closes #1327
Implementation Details
The API for this feature was based on this comment. Check it out :)
I noticed an edge case for a library I wrote to implement this in the past, which is that you probably want to hide a group's usage if all of the flags are hidden.
I'm not sure if you've accounted for this scenario.