remove unneeded error from printOption method

This commit is contained in:
Yik San Chan 2021-12-02 10:33:36 +08:00
parent 9e1d6f1c2a
commit 5e0bbe8bdb

View file

@ -26,7 +26,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) {
flags := cmd.NonInheritedFlags() flags := cmd.NonInheritedFlags()
flags.SetOutput(buf) flags.SetOutput(buf)
if flags.HasAvailableFlags() { if flags.HasAvailableFlags() {
@ -42,7 +42,6 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
parentFlags.PrintDefaults() parentFlags.PrintDefaults()
buf.WriteString("```\n\n") buf.WriteString("```\n\n")
} }
return nil
} }
// GenMarkdown creates markdown output. // GenMarkdown creates markdown output.
@ -74,9 +73,8 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.Example)) buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.Example))
} }
if err := printOptions(buf, cmd, name); err != nil { printOptions(buf, cmd, name)
return err
}
if hasSeeAlso(cmd) { if hasSeeAlso(cmd) {
buf.WriteString("### SEE ALSO\n\n") buf.WriteString("### SEE ALSO\n\n")
if cmd.HasParent() { if cmd.HasParent() {