mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
remove unneeded error from printOption method
This commit is contained in:
parent
9e1d6f1c2a
commit
5e0bbe8bdb
1 changed files with 3 additions and 5 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue