Exemple #1
0
// GenMan will generate a man page for the given command in the out buffer.
// The header argument may be nil, however obviously out may not.
func (cmd *Command) GenMan(header *GenManHeader, out *bytes.Buffer) {
	if header == nil {
		header = &GenManHeader{}
	}
	buf := genMarkdown(cmd, header)
	final := mangen.Render(buf)
	out.Write(final)
}
Exemple #2
0
// 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.
func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
	if header == nil {
		header = &GenManHeader{}
	}
	b := genMan(cmd, header)
	final := mangen.Render(b)
	_, err := w.Write(final)
	return err
}