MCPcopy Create free account
hub / github.com/AdRoll/baker / genConfigKeysText

Function genConfigKeysText

help_text.go:162–182  ·  view source on GitHub ↗
(w io.Writer, keys []helpConfigKey)

Source from the content-addressed store, hash-verified

160}
161
162func genConfigKeysText(w io.Writer, keys []helpConfigKey) {
163 hpad := fmt.Sprintf(helpTextHdrSfmt, "", "", "", "")
164
165 fmt.Fprintf(w, helpTextHdrSfmt, "Name", "Type", "Default", "Required")
166 fmt.Fprintf(w, "Help\n%s\n", helpTextSep)
167
168 for _, k := range keys {
169 fmt.Fprintf(w, helpTextHdrSfmt, k.name, k.typ, k.def, fmt.Sprintf("%t", k.required))
170 helpLines := strings.Split(wrapString(k.desc, 60), "\n")
171 if len(helpLines) > 0 {
172 fmt.Fprint(w, helpLines[0], "\n")
173 for _, h := range helpLines[1:] {
174 fmt.Fprint(w, hpad, " ", h, "\n")
175 }
176 } else {
177 fmt.Fprint(w, "\n")
178 }
179 }
180
181 fmt.Fprint(w, helpTextSep, "\n")
182}
183
184// wrapString wraps the given string within lim width in characters.
185//

Callers 5

genInputTextFunction · 0.85
genFilterTextFunction · 0.85
genOutputTextFunction · 0.85
genUploadTextFunction · 0.85
genMetricsTextFunction · 0.85

Calls 1

wrapStringFunction · 0.85

Tested by

no test coverage detected