(options: TextPromptOptions)
| 307 | }; |
| 308 | |
| 309 | async function textPrompt(options: TextPromptOptions): Promise<string> { |
| 310 | const result = await prompts.text({ |
| 311 | ...options, |
| 312 | validate: (value) => options.validate?.(value?.trim() ? value : options.defaultValue), |
| 313 | }); |
| 314 | if (prompts.isCancel(result)) throw new SetupCancelledError(); |
| 315 | const value = String(result).trim(); |
| 316 | return value || options.defaultValue; |
| 317 | } |
| 318 | |
| 319 | function validatePort(value: string | undefined): string | undefined { |
| 320 | const port = Number(value); |