( choices: Array<CliChoice<T> | Separator>, promptMessage?: string, maxChoices?: number, )
| 68 | } |
| 69 | |
| 70 | export async function getUserChoice<T>( |
| 71 | choices: Array<CliChoice<T> | Separator>, |
| 72 | promptMessage?: string, |
| 73 | maxChoices?: number, |
| 74 | ): Promise<T> { |
| 75 | const answers = await inquirer.prompt<{ selectedChoice: T }>([ |
| 76 | { |
| 77 | type: 'list', |
| 78 | name: 'selectedChoice', |
| 79 | message: promptMessage ?? 'Please select an option:', |
| 80 | choices: choices, |
| 81 | loop: false, |
| 82 | pageSize: maxChoices ?? 10, |
| 83 | }, |
| 84 | ]); |
| 85 | |
| 86 | return answers.selectedChoice; |
| 87 | } |
| 88 | |
| 89 | export async function getUserConfirmation(promptMessage?: string, defaultConfirm: boolean = false): Promise<boolean> { |
| 90 | const answer = await inquirer.prompt<{ confirm: boolean }>([ |
no outgoing calls
no test coverage detected