From 5e0bbe8bdb09fa3b154cb23c3ce67248209c1eb3 Mon Sep 17 00:00:00 2001 From: Yik San Chan Date: Thu, 2 Dec 2021 10:33:36 +0800 Subject: [PATCH] remove unneeded error from printOption method --- doc/md_docs.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/md_docs.go b/doc/md_docs.go index 5181af8d..9df609ea 100644 --- a/doc/md_docs.go +++ b/doc/md_docs.go @@ -26,7 +26,7 @@ import ( "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.SetOutput(buf) if flags.HasAvailableFlags() { @@ -42,7 +42,6 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { parentFlags.PrintDefaults() buf.WriteString("```\n\n") } - return nil } // 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)) } - if err := printOptions(buf, cmd, name); err != nil { - return err - } + printOptions(buf, cmd, name) + if hasSeeAlso(cmd) { buf.WriteString("### SEE ALSO\n\n") if cmd.HasParent() {