(w io.Writer, keys []helpConfigKey)
| 160 | } |
| 161 | |
| 162 | func 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 | // |
no test coverage detected