Skip to content
Myr

man_examples_test.go

This file

Path

doc/man_examples_test.go

35 lines · 588 bytes · Go

Last changed by

Use golangci-lint (#1044)Unai Martinez-Corralbefore adoption652c755

History of this file

Take it

1package doc_test23import (4	"bytes"5	"fmt"67	"github.com/spf13/cobra"8	"github.com/spf13/cobra/doc"9)1011func ExampleGenManTree() {12	cmd := &cobra.Command{13		Use:   "test",14		Short: "my test program",15	}16	header := &doc.GenManHeader{17		Title:   "MINE",18		Section: "3",19	}20	cobra.CheckErr(doc.GenManTree(cmd, header, "/tmp"))21}2223func ExampleGenMan() {24	cmd := &cobra.Command{25		Use:   "test",26		Short: "my test program",27	}28	header := &doc.GenManHeader{29		Title:   "MINE",30		Section: "3",31	}32	out := new(bytes.Buffer)33	cobra.CheckErr(doc.GenMan(cmd, header, out))34	fmt.Print(out.String())35}