spf13--cobra/doc/man_examples_test.go
2020-01-06 19:25:48 +01:00

39 lines
609 B
Go

package doc_test
import (
"bytes"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)
func er(msg interface{}) {
cobra.Er(msg)
}
func ExampleGenManTree() {
cmd := &cobra.Command{
Use: "test",
Short: "my test program",
}
header := &doc.GenManHeader{
Title: "MINE",
Section: "3",
}
er(doc.GenManTree(cmd, header, "/tmp"))
}
func ExampleGenMan() {
cmd := &cobra.Command{
Use: "test",
Short: "my test program",
}
header := &doc.GenManHeader{
Title: "MINE",
Section: "3",
}
out := new(bytes.Buffer)
er(doc.GenMan(cmd, header, out))
fmt.Print(out.String())
}