X Tutup
Skip to content

Commit f8ce68f

Browse files
committed
Remove SEE ALSO from markdown docs generation
1 parent 699c9ae commit f8ce68f

File tree

3 files changed

+0
-30
lines changed

3 files changed

+0
-30
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ site-docs: site
4444
git -C site pull
4545
git -C site rm 'manual/gh*.md' 2>/dev/null || true
4646
go run ./cmd/gen-docs --website --doc-path site/manual
47-
for f in site/manual/gh*.md; do sed -i.bak -e '/^### SEE ALSO/,$$d' "$$f"; done
4847
rm -f site/manual/*.bak
4948
git -C site add 'manual/gh*.md'
5049
git -C site commit -m 'update help docs' || true

internal/docs/markdown.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"io"
77
"os"
88
"path/filepath"
9-
"sort"
109
"strings"
1110

1211
"github.com/spf13/cobra"
@@ -63,30 +62,6 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
6362
if err := printOptions(buf, cmd, name); err != nil {
6463
return err
6564
}
66-
if hasSeeAlso(cmd) {
67-
buf.WriteString("### SEE ALSO\n\n")
68-
if cmd.HasParent() {
69-
parent := cmd.Parent()
70-
pname := parent.CommandPath()
71-
link := pname + ".md"
72-
link = strings.Replace(link, " ", "_", -1)
73-
buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short))
74-
}
75-
76-
children := cmd.Commands()
77-
sort.Sort(byName(children))
78-
79-
for _, child := range children {
80-
if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
81-
continue
82-
}
83-
cname := name + " " + child.Name()
84-
link := cname + ".md"
85-
link = strings.Replace(link, " ", "_", -1)
86-
buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short))
87-
}
88-
buf.WriteString("\n")
89-
}
9065
_, err := buf.WriteTo(w)
9166
return err
9267
}

internal/docs/markdown_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ func TestGenMdDoc(t *testing.T) {
2222
checkStringContains(t, output, echoCmd.Example)
2323
checkStringContains(t, output, "boolone")
2424
checkStringContains(t, output, "rootflag")
25-
checkStringContains(t, output, rootCmd.Short)
26-
checkStringContains(t, output, echoSubCmd.Short)
2725
checkStringOmits(t, output, deprecatedCmd.Short)
2826
checkStringContains(t, output, "Options inherited from parent commands")
2927
}
@@ -59,8 +57,6 @@ func TestGenMdNoHiddenParents(t *testing.T) {
5957
checkStringContains(t, output, echoCmd.Example)
6058
checkStringContains(t, output, "boolone")
6159
checkStringOmits(t, output, "rootflag")
62-
checkStringContains(t, output, rootCmd.Short)
63-
checkStringContains(t, output, echoSubCmd.Short)
6460
checkStringOmits(t, output, deprecatedCmd.Short)
6561
checkStringOmits(t, output, "Options inherited from parent commands")
6662
}

0 commit comments

Comments
 (0)
X Tutup