From 2a29690c1f1e9f3a373f535aa0046a1bfd795b2d Mon Sep 17 00:00:00 2001 From: Naveen Gogineni Date: Sun, 7 Jun 2026 06:45:05 -0400 Subject: [PATCH 1/2] fix: show GLOBAL OPTIONS in SubcommandHelpTemplate SubcommandHelpTemplate was missing the VisiblePersistentFlags section, so subcommands with their own subcommands would not display GLOBAL OPTIONS when help was shown via ShowSubcommandHelp. This aligns SubcommandHelpTemplate with CommandHelpTemplate, which already includes the GLOBAL OPTIONS section. --- template.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/template.go b/template.go index dd144e77dd..92030cc8fd 100644 --- a/template.go +++ b/template.go @@ -107,7 +107,9 @@ COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategori OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} -OPTIONS:{{template "visibleFlagTemplate" .}}{{end}} +OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}{{if .VisiblePersistentFlags}} + +GLOBAL OPTIONS:{{template "visiblePersistentFlagTemplate" .}}{{end}} ` var FishCompletionTemplate = `# {{ .Command.Name }} fish shell completion From 541d0c8d934b59f52ea5c95bc132fcd6d054ac29 Mon Sep 17 00:00:00 2001 From: Naveen Gogineni Date: Mon, 8 Jun 2026 05:50:39 -0400 Subject: [PATCH 2/2] chore: update godoc and approve v3 API surface --- godoc-current.txt | 4 +++- testdata/godoc-v3.x.txt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/godoc-current.txt b/godoc-current.txt index 681df19d63..5626b3b3d2 100644 --- a/godoc-current.txt +++ b/godoc-current.txt @@ -170,7 +170,9 @@ COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategori OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} -OPTIONS:{{template "visibleFlagTemplate" .}}{{end}} +OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}{{if .VisiblePersistentFlags}} + +GLOBAL OPTIONS:{{template "visiblePersistentFlagTemplate" .}}{{end}} ` SubcommandHelpTemplate is the text template for the subcommand help topic. cli.go uses text/template to render templates. You can render custom help diff --git a/testdata/godoc-v3.x.txt b/testdata/godoc-v3.x.txt index 681df19d63..5626b3b3d2 100644 --- a/testdata/godoc-v3.x.txt +++ b/testdata/godoc-v3.x.txt @@ -170,7 +170,9 @@ COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategori OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} -OPTIONS:{{template "visibleFlagTemplate" .}}{{end}} +OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}{{if .VisiblePersistentFlags}} + +GLOBAL OPTIONS:{{template "visiblePersistentFlagTemplate" .}}{{end}} ` SubcommandHelpTemplate is the text template for the subcommand help topic. cli.go uses text/template to render templates. You can render custom help