(option: Option)
| 264 | } |
| 265 | |
| 266 | function buildOptionDetails(option: Option): string[] { |
| 267 | const details: string[] = []; |
| 268 | |
| 269 | if (option.mandatory) { |
| 270 | details.push("Must be specified."); |
| 271 | } |
| 272 | |
| 273 | if (option.required) { |
| 274 | details.push("Requires a value."); |
| 275 | } else if (option.optional) { |
| 276 | details.push("Accepts an optional value."); |
| 277 | } |
| 278 | |
| 279 | if (option.defaultValueDescription) { |
| 280 | details.push(`Default: ${option.defaultValueDescription}.`); |
| 281 | } else if (option.defaultValue !== undefined) { |
| 282 | details.push(`Default: ${formatValue(option.defaultValue)}.`); |
| 283 | } |
| 284 | |
| 285 | if (option.argChoices && option.argChoices.length > 0) { |
| 286 | details.push(`Allowed values: ${option.argChoices.join(", ")}.`); |
| 287 | } |
| 288 | |
| 289 | if (option.envVar) { |
| 290 | details.push(`Environment variable: ${option.envVar}.`); |
| 291 | } |
| 292 | |
| 293 | if (option.presetArg !== undefined) { |
| 294 | details.push(`Preset value: ${formatValue(option.presetArg)}.`); |
| 295 | } |
| 296 | |
| 297 | return details; |
| 298 | } |
| 299 | |
| 300 | type BuildOptionEntriesArgs = { |
| 301 | options: Option[]; |
no test coverage detected
searching dependent graphs…