cli icon indicating copy to clipboard operation
cli copied to clipboard

Reporting of persistent flags in help

Open fjl opened this issue 1 year ago • 0 comments

As I am continuing work on converting our app to cli v3, I noticed that persistent flags in help for subcommands do not show the categories. Our app has a lot of 'global options' which are shared by all subcommands, and very few local flags on the commands themselves. So showing the global options correctly is essential.

At this time, for --help on a subcommand, inherited flags are shown as a plain list, under the heading GLOBAL OPTIONS. It can't be changed in the template either, since there is no method on command to retrieve the categories.

The two resolutions I see are:

  • adding a method like: VisibleGlobalFlagCategories to Command. Then I could re-implement the listing by overriding the template.
  • same as above, but put this feature in the default template.

fjl avatar Jan 06 '25 15:01 fjl