( message: string, defaultResponse: boolean, noTTYResponse?: boolean, )
| 9 | import { isTTY } from './tty'; |
| 10 | |
| 11 | export async function askConfirmation( |
| 12 | message: string, |
| 13 | defaultResponse: boolean, |
| 14 | noTTYResponse?: boolean, |
| 15 | ): Promise<boolean> { |
| 16 | if (!isTTY()) { |
| 17 | return noTTYResponse ?? defaultResponse; |
| 18 | } |
| 19 | |
| 20 | const { confirm } = await import('@inquirer/prompts'); |
| 21 | const answer = await confirm({ |
| 22 | message, |
| 23 | default: defaultResponse, |
| 24 | theme: { |
| 25 | prefix: '', |
| 26 | }, |
| 27 | }); |
| 28 | |
| 29 | return answer; |
| 30 | } |
| 31 | |
| 32 | export async function askQuestion( |
| 33 | message: string, |
no test coverage detected