MCPcopy
hub / github.com/prettier/prettier / createDetailedUsage

Function createDetailedUsage

src/cli/usage.js:169–194  ·  view source on GitHub ↗
(context, flag)

Source from the content-addressed store, hash-verified

167}
168
169function createDetailedUsage(context, flag) {
170 const option = getOptionsWithOpposites(context.detailedOptions).find(
171 (option) => option.name === flag || option.alias === flag,
172 );
173
174 const header = createOptionUsageHeader(option);
175 const description = `\n\n${indent(option.description, 2)}`;
176
177 const choices =
178 option.type !== "choice"
179 ? ""
180 : `\n\nValid options:\n\n${createChoiceUsages(
181 option.choices,
182 CHOICE_USAGE_MARGIN,
183 CHOICE_USAGE_INDENTATION,
184 ).join("\n")}`;
185
186 const optionDefaultValue = getOptionDefaultValue(context, option.name);
187 const defaults =
188 optionDefaultValue !== undefined
189 ? `\n\nDefault: ${createDefaultValueDisplay(optionDefaultValue)}`
190 : "";
191
192 const pluginDefaults = createPluginDefaults(option.pluginDefaults);
193 return `${header}${description}${choices}${defaults}${pluginDefaults}`;
194}
195
196export { createDetailedUsage, createUsage };

Callers 1

mainFunction · 0.90

Calls 7

getOptionsWithOppositesFunction · 0.85
createOptionUsageHeaderFunction · 0.85
createChoiceUsagesFunction · 0.85
getOptionDefaultValueFunction · 0.85
createPluginDefaultsFunction · 0.85
indentFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…