Skip to content

Commit

Permalink
fix inconsistencies in md generation
Browse files Browse the repository at this point in the history
  • Loading branch information
kajes committed Oct 11, 2023
1 parent 95d8a1e commit 5d16684
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions doc/md_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ 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")
}

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")
}
Expand Down
6 changes: 3 additions & 3 deletions doc/md_docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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")
}

Expand All @@ -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) {
Expand Down

0 comments on commit 5d16684

Please sign in to comment.