| 1245 | } |
| 1246 | |
| 1247 | function 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 | |
| 1288 | function printAllConfigHelp() { |
| 1289 | console.log(chalk.bold('Available config parameters:')); |