MCPcopy
hub / github.com/spf13/cobra / GenMan

Function GenMan

doc/man_docs.go:105–116  ·  view source on GitHub ↗

GenMan will generate a man page for the given command and write it to w. The header argument may be nil, however obviously w may not.

(cmd *cobra.Command, header *GenManHeader, w io.Writer)

Source from the content-addressed store, hash-verified

103// GenMan will generate a man page for the given command and write it to
104// w. The header argument may be nil, however obviously w may not.
105func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
106 if header == nil {
107 header = &GenManHeader{}
108 }
109 if err := fillHeader(header, cmd.CommandPath(), cmd.DisableAutoGenTag); err != nil {
110 return err
111 }
112
113 b := genMan(cmd, header)
114 _, err := w.Write(md2man.Render(b))
115 return err
116}
117
118func fillHeader(header *GenManHeader, name string, disableAutoGen bool) error {
119 if header.Title == "" {

Callers 7

ExampleGenManFunction · 0.92
TestGenManDocFunction · 0.85
TestGenManNoGenTagFunction · 0.85
TestGenManSeeAlsoFunction · 0.85
BenchmarkGenManToFileFunction · 0.85
GenManTreeFromOptsFunction · 0.85

Calls 3

fillHeaderFunction · 0.85
genManFunction · 0.85
CommandPathMethod · 0.80

Tested by 6

ExampleGenManFunction · 0.74
TestGenManDocFunction · 0.68
TestGenManNoGenTagFunction · 0.68
TestGenManSeeAlsoFunction · 0.68
BenchmarkGenManToFileFunction · 0.68