(context, flag)
| 167 | } |
| 168 | |
| 169 | function 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 | |
| 196 | export { createDetailedUsage, createUsage }; |
no test coverage detected
searching dependent graphs…