cli icon indicating copy to clipboard operation
cli copied to clipboard

Subcommands do not display help for GLOBAL OPTIONS

Open seanamos opened this issue 9 months ago • 1 comments

Version: 706f78e

My initial look for a the cause is that the default SubcommandHelpTemplate does not contain:

{{if .VisiblePersistentFlags}}

GLOBAL OPTIONS:{{template "visiblePersistentFlagTemplate" .}}{{end}}

See CommandHelpTemplate where this is implemented.

seanamos avatar Mar 17 '25 09:03 seanamos

I've found this to be the case as well if the -h flag is not used. If the -h flag is used then the CommandHelpTemplate is used which does include the GLOBAL OPTIONS snippet. If the -h flag is not used then the SubcommandHelpTemplate is used which does not include the GLOBAL OPTIONS snippet. I haven't traced through the logic of where that template choice is being made. Not sure which side the solution should be on really.

jwetzell avatar Oct 02 '25 17:10 jwetzell