mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Revert back to 'Global Flags'
This commit is contained in:
parent
44242f9e60
commit
b28f2326ca
4 changed files with 6 additions and 6 deletions
|
@ -568,7 +568,7 @@ Additional Commands:{{range $cmds}}{{if (and (eq .GroupID "") (or .IsAvailableCo
|
||||||
Flags:
|
Flags:
|
||||||
{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
|
{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
|
||||||
|
|
||||||
Flags inherited from parent commands:
|
Global Flags:
|
||||||
{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}
|
{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}
|
||||||
|
|
||||||
Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
|
Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
|
||||||
|
|
|
@ -921,7 +921,7 @@ Flags:
|
||||||
--foo child foo usage
|
--foo child foo usage
|
||||||
-h, --help help for child
|
-h, --help help for child
|
||||||
|
|
||||||
Flags inherited from parent commands:
|
Global Flags:
|
||||||
--bar parent bar usage
|
--bar parent bar usage
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
|
||||||
parentFlags := cmd.InheritedFlags()
|
parentFlags := cmd.InheritedFlags()
|
||||||
parentFlags.SetOutput(buf)
|
parentFlags.SetOutput(buf)
|
||||||
if parentFlags.HasAvailableFlags() {
|
if parentFlags.HasAvailableFlags() {
|
||||||
buf.WriteString("### Flags inherited from parent commands\n\n```\n")
|
buf.WriteString("### Global Flags\n\n```\n")
|
||||||
parentFlags.PrintDefaults()
|
parentFlags.PrintDefaults()
|
||||||
buf.WriteString("```\n\n")
|
buf.WriteString("```\n\n")
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ func TestGenMdDoc(t *testing.T) {
|
||||||
checkStringContains(t, output, rootCmd.Short)
|
checkStringContains(t, output, rootCmd.Short)
|
||||||
checkStringContains(t, output, echoSubCmd.Short)
|
checkStringContains(t, output, echoSubCmd.Short)
|
||||||
checkStringOmits(t, output, deprecatedCmd.Short)
|
checkStringOmits(t, output, deprecatedCmd.Short)
|
||||||
checkStringContains(t, output, "Flags inherited from parent commands")
|
checkStringContains(t, output, "Global Flags")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
|
func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
|
||||||
|
@ -52,7 +52,7 @@ func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
|
||||||
|
|
||||||
checkStringContains(t, output, dummyCmd.Example)
|
checkStringContains(t, output, dummyCmd.Example)
|
||||||
checkStringContains(t, output, dummyCmd.Short)
|
checkStringContains(t, output, dummyCmd.Short)
|
||||||
checkStringContains(t, output, "Flags inherited from parent commands")
|
checkStringContains(t, output, "Global Flags")
|
||||||
checkStringOmits(t, output, "### Synopsis")
|
checkStringOmits(t, output, "### Synopsis")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ func TestGenMdNoHiddenParents(t *testing.T) {
|
||||||
checkStringContains(t, output, rootCmd.Short)
|
checkStringContains(t, output, rootCmd.Short)
|
||||||
checkStringContains(t, output, echoSubCmd.Short)
|
checkStringContains(t, output, echoSubCmd.Short)
|
||||||
checkStringOmits(t, output, deprecatedCmd.Short)
|
checkStringOmits(t, output, deprecatedCmd.Short)
|
||||||
checkStringOmits(t, output, "Flags inherited from parent commands")
|
checkStringOmits(t, output, "Global Flags")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenMdNoTag(t *testing.T) {
|
func TestGenMdNoTag(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue