mirror of
https://github.com/spf13/cobra
synced 2025-04-07 23:39:12 +00:00
Merge b28f2326ca
into ceb39aba25
This commit is contained in:
commit
26bb548276
2 changed files with 5 additions and 5 deletions
|
@ -33,7 +33,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")
|
||||
}
|
||||
|
@ -41,7 +41,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("### Global Flags\n\n```\n")
|
||||
parentFlags.PrintDefaults()
|
||||
buf.WriteString("```\n\n")
|
||||
}
|
||||
|
|
|
@ -38,7 +38,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, "Global Flags")
|
||||
}
|
||||
|
||||
func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
|
||||
|
@ -51,7 +51,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, "Global Flags")
|
||||
checkStringOmits(t, output, "### Synopsis")
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,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, "Global Flags")
|
||||
}
|
||||
|
||||
func TestGenMdNoTag(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue