MCPcopy
hub / github.com/cli/cli / manPreamble

Function manPreamble

internal/docs/man.go:128–140  ·  view source on GitHub ↗
(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, dashedName string)

Source from the content-addressed store, hash-verified

126}
127
128func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, dashedName string) {
129 buf.WriteString(fmt.Sprintf(`%% "%s" "%s" "%s" "%s" "%s"
130# NAME
131`, header.Title, header.Section, header.Date.Format("Jan 2006"), header.Source, header.Manual))
132 buf.WriteString(fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short))
133 buf.WriteString("# SYNOPSIS\n")
134 buf.WriteString(fmt.Sprintf("`%s`\n\n", cmd.UseLine()))
135
136 if cmd.Long != "" && cmd.Long != cmd.Short {
137 buf.WriteString("# DESCRIPTION\n")
138 buf.WriteString(cmd.Long + "\n\n")
139 }
140}
141
142func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) {
143 flags.VisitAll(func(flag *pflag.Flag) {

Callers 1

genManFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected