MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / printConfigKeyHelp

Function printConfigKeyHelp

src/commands/config.ts:1247–1286  ·  view source on GitHub ↗
(param)

Source from the content-addressed store, hash-verified

1245}
1246
1247function printConfigKeyHelp(param) {
1248 if (!Object.values(CONFIG_KEYS).includes(param)) {
1249 console.log(chalk.red(`Unknown config parameter: ${param}`));
1250 return;
1251 }
1252
1253 const details = getConfigKeyDetails(param as CONFIG_KEYS);
1254
1255 let desc = details.description;
1256 let defaultValue = undefined;
1257 if (param in DEFAULT_CONFIG) {
1258 defaultValue = DEFAULT_CONFIG[param];
1259 }
1260
1261 console.log(chalk.bold(`\n${param}:`));
1262 console.log(chalk.gray(` Description: ${desc}`));
1263 if (defaultValue !== undefined) {
1264 // Print booleans and numbers as-is, strings without quotes
1265 if (typeof defaultValue === 'string') {
1266 console.log(chalk.gray(` Default: ${defaultValue}`));
1267 } else {
1268 console.log(chalk.gray(` Default: ${defaultValue}`));
1269 }
1270 }
1271
1272 if (Array.isArray(details.values)) {
1273 console.log(chalk.gray(' Accepted values:'));
1274 details.values.forEach((value) => {
1275 console.log(chalk.gray(` - ${value}`));
1276 });
1277 } else {
1278 console.log(chalk.gray(' Accepted values by provider:'));
1279 Object.entries(details.values).forEach(([provider, values]) => {
1280 console.log(chalk.gray(` ${provider}:`));
1281 (values as string[]).forEach((value) => {
1282 console.log(chalk.gray(` - ${value}`));
1283 });
1284 });
1285 }
1286}
1287
1288function printAllConfigHelp() {
1289 console.log(chalk.bold('Available config parameters:'));

Callers 1

config.tsFile · 0.70

Calls 6

includesMethod · 0.80
boldMethod · 0.80
getConfigKeyDetailsFunction · 0.70
valuesMethod · 0.45
forEachMethod · 0.45
entriesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…