From 5d16684e884a90a490de82abda45720cc1f74a4a Mon Sep 17 00:00:00 2001
From: Lars Kajes <lars.kajes@appgate.com>
Date: Wed, 11 Oct 2023 14:40:55 +0200
Subject: [PATCH 1/3] fix inconsistencies in md generation

---
 doc/md_docs.go      | 4 ++--
 doc/md_docs_test.go | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/md_docs.go b/doc/md_docs.go
index c4a27c00..ba9de3ff 100644
--- a/doc/md_docs.go
+++ b/doc/md_docs.go
@@ -31,7 +31,7 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
 	flags := cmd.NonInheritedFlags()
 	flags.SetOutput(buf)
 	if flags.HasAvailableFlags() {
-		buf.WriteString("### Options\n\n```\n")
+		buf.WriteString("### Flags\n\n```\n")
 		flags.PrintDefaults()
 		buf.WriteString("```\n\n")
 	}
@@ -39,7 +39,7 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
 	parentFlags := cmd.InheritedFlags()
 	parentFlags.SetOutput(buf)
 	if parentFlags.HasAvailableFlags() {
-		buf.WriteString("### Options inherited from parent commands\n\n```\n")
+		buf.WriteString("### Flags inherited from parent commands\n\n```\n")
 		parentFlags.PrintDefaults()
 		buf.WriteString("```\n\n")
 	}
diff --git a/doc/md_docs_test.go b/doc/md_docs_test.go
index e70cad82..4cdf95d1 100644
--- a/doc/md_docs_test.go
+++ b/doc/md_docs_test.go
@@ -39,7 +39,7 @@ func TestGenMdDoc(t *testing.T) {
 	checkStringContains(t, output, rootCmd.Short)
 	checkStringContains(t, output, echoSubCmd.Short)
 	checkStringOmits(t, output, deprecatedCmd.Short)
-	checkStringContains(t, output, "Options inherited from parent commands")
+	checkStringContains(t, output, "Flags inherited from parent commands")
 }
 
 func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
@@ -52,7 +52,7 @@ func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
 
 	checkStringContains(t, output, dummyCmd.Example)
 	checkStringContains(t, output, dummyCmd.Short)
-	checkStringContains(t, output, "Options inherited from parent commands")
+	checkStringContains(t, output, "Flags inherited from parent commands")
 	checkStringOmits(t, output, "### Synopsis")
 }
 
@@ -76,7 +76,7 @@ func TestGenMdNoHiddenParents(t *testing.T) {
 	checkStringContains(t, output, rootCmd.Short)
 	checkStringContains(t, output, echoSubCmd.Short)
 	checkStringOmits(t, output, deprecatedCmd.Short)
-	checkStringOmits(t, output, "Options inherited from parent commands")
+	checkStringOmits(t, output, "Flags inherited from parent commands")
 }
 
 func TestGenMdNoTag(t *testing.T) {

From 44242f9e609f6b3b0b3a342fe396e0471eb35a23 Mon Sep 17 00:00:00 2001
From: Lars Kajes <lars.kajes@appgate.com>
Date: Wed, 11 Oct 2023 14:44:08 +0200
Subject: [PATCH 2/3] falgs are inherited, not global

---
 command.go      | 2 +-
 command_test.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/command.go b/command.go
index 909d8585..bded3df4 100644
--- a/command.go
+++ b/command.go
@@ -568,7 +568,7 @@ Additional Commands:{{range $cmds}}{{if (and (eq .GroupID "") (or .IsAvailableCo
 Flags:
 {{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
 
-Global Flags:
+Flags inherited from parent commands:
 {{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}
 
 Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
diff --git a/command_test.go b/command_test.go
index 4afb7f7b..8675c912 100644
--- a/command_test.go
+++ b/command_test.go
@@ -921,7 +921,7 @@ Flags:
       --foo    child foo usage
   -h, --help   help for child
 
-Global Flags:
+Flags inherited from parent commands:
       --bar   parent bar usage
 `
 

From b28f2326ca5cf8402907ce3531c5cd3ec6919b52 Mon Sep 17 00:00:00 2001
From: Lars Kajes <lars.kajes@appgate.com>
Date: Mon, 6 Nov 2023 09:34:40 +0100
Subject: [PATCH 3/3] Revert back to 'Global Flags'

---
 command.go          | 2 +-
 command_test.go     | 2 +-
 doc/md_docs.go      | 2 +-
 doc/md_docs_test.go | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/command.go b/command.go
index bded3df4..909d8585 100644
--- a/command.go
+++ b/command.go
@@ -568,7 +568,7 @@ Additional Commands:{{range $cmds}}{{if (and (eq .GroupID "") (or .IsAvailableCo
 Flags:
 {{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
 
-Flags inherited from parent commands:
+Global Flags:
 {{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}
 
 Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
diff --git a/command_test.go b/command_test.go
index 8675c912..4afb7f7b 100644
--- a/command_test.go
+++ b/command_test.go
@@ -921,7 +921,7 @@ Flags:
       --foo    child foo usage
   -h, --help   help for child
 
-Flags inherited from parent commands:
+Global Flags:
       --bar   parent bar usage
 `
 
diff --git a/doc/md_docs.go b/doc/md_docs.go
index ba9de3ff..0bb2ae32 100644
--- a/doc/md_docs.go
+++ b/doc/md_docs.go
@@ -39,7 +39,7 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
 	parentFlags := cmd.InheritedFlags()
 	parentFlags.SetOutput(buf)
 	if parentFlags.HasAvailableFlags() {
-		buf.WriteString("### Flags inherited from parent commands\n\n```\n")
+		buf.WriteString("### Global Flags\n\n```\n")
 		parentFlags.PrintDefaults()
 		buf.WriteString("```\n\n")
 	}
diff --git a/doc/md_docs_test.go b/doc/md_docs_test.go
index 4cdf95d1..a441d2f4 100644
--- a/doc/md_docs_test.go
+++ b/doc/md_docs_test.go
@@ -39,7 +39,7 @@ func TestGenMdDoc(t *testing.T) {
 	checkStringContains(t, output, rootCmd.Short)
 	checkStringContains(t, output, echoSubCmd.Short)
 	checkStringOmits(t, output, deprecatedCmd.Short)
-	checkStringContains(t, output, "Flags inherited from parent commands")
+	checkStringContains(t, output, "Global Flags")
 }
 
 func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
@@ -52,7 +52,7 @@ func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
 
 	checkStringContains(t, output, dummyCmd.Example)
 	checkStringContains(t, output, dummyCmd.Short)
-	checkStringContains(t, output, "Flags inherited from parent commands")
+	checkStringContains(t, output, "Global Flags")
 	checkStringOmits(t, output, "### Synopsis")
 }
 
@@ -76,7 +76,7 @@ func TestGenMdNoHiddenParents(t *testing.T) {
 	checkStringContains(t, output, rootCmd.Short)
 	checkStringContains(t, output, echoSubCmd.Short)
 	checkStringOmits(t, output, deprecatedCmd.Short)
-	checkStringOmits(t, output, "Flags inherited from parent commands")
+	checkStringOmits(t, output, "Global Flags")
 }
 
 func TestGenMdNoTag(t *testing.T) {