1
0

man_examples_test.go 556 B

1234567891011121314151617181920212223242526272829303132333435
  1. package doc_test
  2. import (
  3. "bytes"
  4. "fmt"
  5. "github.com/spf13/cobra"
  6. "github.com/spf13/cobra/doc"
  7. )
  8. func ExampleGenManTree() {
  9. cmd := &cobra.Command{
  10. Use: "test",
  11. Short: "my test program",
  12. }
  13. header := &doc.GenManHeader{
  14. Title: "MINE",
  15. Section: "3",
  16. }
  17. doc.GenManTree(cmd, header, "/tmp")
  18. }
  19. func ExampleGenMan() {
  20. cmd := &cobra.Command{
  21. Use: "test",
  22. Short: "my test program",
  23. }
  24. header := &doc.GenManHeader{
  25. Title: "MINE",
  26. Section: "3",
  27. }
  28. out := new(bytes.Buffer)
  29. doc.GenMan(cmd, header, out)
  30. fmt.Print(out.String())
  31. }