MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / buildOptionDetails

Function buildOptionDetails

scripts/docs/src/generate-cli-docs.ts:266–298  ·  view source on GitHub ↗
(option: Option)

Source from the content-addressed store, hash-verified

264}
265
266function 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
300type BuildOptionEntriesArgs = {
301 options: Option[];

Callers 1

buildOptionEntriesFunction · 0.85

Calls 2

formatValueFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…