cobra/examples_test.go
Eric Paris edcf765d9f Mangen: allow callers to specify header information
We previously had this weak argument called projectName which let you
set a single part of a man page header. Instead do the best we can if
the caller doesn't pass us anything, but let the caller specify anything
they want.
2015-09-08 18:52:09 -04:00

35 lines
538 B
Go

package cobra_test
import (
"bytes"
"fmt"
"github.com/spf13/cobra"
)
func ExampleCommand_GenManTree() {
cmd := &cobra.Command{
Use: "test",
Short: "my test program",
}
header := &cobra.GenManHeader{
Title: "MINE",
Section: "3",
}
cmd.GenManTree(header, "/tmp")
}
func ExampleCommand_GenMan() {
cmd := &cobra.Command{
Use: "test",
Short: "my test program",
}
header := &cobra.GenManHeader{
Title: "MINE",
Section: "3",
}
out := new(bytes.Buffer)
cmd.GenMan(header, out)
fmt.Print(out.String())
}