( mod: Record<string, unknown>, exportName?: string, )
| 98 | } |
| 99 | |
| 100 | function findPromptOptions( |
| 101 | mod: Record<string, unknown>, |
| 102 | exportName?: string, |
| 103 | ): PromptOptions | undefined { |
| 104 | if (exportName) { |
| 105 | const val = mod[exportName]; |
| 106 | return isPromptOptions(val) ? val : undefined; |
| 107 | } |
| 108 | |
| 109 | // Check well-known names first |
| 110 | for (const name of ["promptOptions", "options"]) { |
| 111 | if (isPromptOptions(mod[name])) return mod[name] as PromptOptions; |
| 112 | } |
| 113 | |
| 114 | // Check any export ending with "PromptOptions" or "promptOptions" |
| 115 | for (const [key, val] of Object.entries(mod)) { |
| 116 | if (/[Pp]rompt[Oo]ptions$/.test(key) && isPromptOptions(val)) return val; |
| 117 | } |
| 118 | |
| 119 | return undefined; |
| 120 | } |
| 121 | |
| 122 | async function main(): Promise<void> { |
| 123 | const args = process.argv.slice(2); |
no test coverage detected