cobra icon indicating copy to clipboard operation
cobra copied to clipboard

feat: add flag help groups

Open pedromotita opened this issue 11 months ago • 2 comments

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 :)

pedromotita avatar Mar 07 '24 18:03 pedromotita

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 07 '24 18:03 CLAassistant

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.

jzelinskie avatar May 10 '24 15:05 jzelinskie