fixups
parent
270d4cf5c0
commit
7988704bed
|
|
@ -26,7 +26,7 @@ import (
|
|||
"k8s.io/minikube/pkg/generate"
|
||||
)
|
||||
|
||||
func TestCommandsDocs(t *testing.T) {
|
||||
func TestGenerateDocs(t *testing.T) {
|
||||
dir := "../../../site/content/en/docs/Reference/Commands/"
|
||||
|
||||
for _, sc := range RootCmd.Commands() {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ func DocForCommand(command *cobra.Command) (string, error) {
|
|||
if err := writeSubcommands(command, buf); err != nil {
|
||||
return "", errors.Wrap(err, "writing subcommands")
|
||||
}
|
||||
edited := removeHelpCommand(buf)
|
||||
edited := removeHelpText(buf)
|
||||
return rewriteFlags(command, edited), nil
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ func DocForCommand(command *cobra.Command) (string, error) {
|
|||
// ###### Auto generated by spf13/cobra on 1-Apr-2020
|
||||
// help text which is unnecessary info after every subcommand
|
||||
// This function removes that text.
|
||||
func removeHelpCommand(buffer *bytes.Buffer) string {
|
||||
func removeHelpText(buffer *bytes.Buffer) string {
|
||||
beginningHelpText := "### SEE ALSO"
|
||||
endHelpText := "###### Auto generated by spf13/cobra"
|
||||
scanner := bufio.NewScanner(buffer)
|
||||
|
|
@ -99,6 +99,7 @@ func removeHelpCommand(buffer *bytes.Buffer) string {
|
|||
return final.String()
|
||||
}
|
||||
|
||||
// writeSubcommands recursively appends all subcommands to the doc
|
||||
func writeSubcommands(command *cobra.Command, w io.Writer) error {
|
||||
if err := doc.GenMarkdown(command, w); err != nil {
|
||||
return errors.Wrapf(err, "getting markdown custom")
|
||||
|
|
|
|||
Loading…
Reference in New Issue