spf13--cobra/doc/man_examples_test.go

40 lines
601 B
Go
Raw Normal View History

package doc_test
import (
"bytes"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)
2019-06-07 21:55:25 +02:00
func er(msg interface{}) {
cobra.Er(msg)
}
2017-04-01 22:45:39 +02:00
func ExampleGenManTree() {
cmd := &cobra.Command{
Use: "test",
Short: "my test program",
}
header := &doc.GenManHeader{
Title: "MINE",
Section: "3",
}
doc.GenManTree(cmd, header, "/tmp")
}
2017-04-01 22:45:39 +02:00
func ExampleGenMan() {
cmd := &cobra.Command{
Use: "test",
Short: "my test program",
}
header := &doc.GenManHeader{
Title: "MINE",
Section: "3",
}
out := new(bytes.Buffer)
doc.GenMan(cmd, header, out)
fmt.Print(out.String())
}