import {TerminalInput} from './TerminalInput'; const yes = ['y', 'yes']; const no = ['n', 'no']; const validate = (value: string) => ( yes.includes(value.toLowerCase()) || no.includes(value.toLowerCase()) ); const getHint = (value: string) => { if (value && !validate(value)) { return 'Enter yes or no (y/n)'; } return ''; }; export namespace TerminalConfirm { export async function ask(question: string, hint: string = '') { const result = await TerminalInput.ask(question, { getHint: (value) => getHint(value) || hint, validate, clearOnInvalidInput: true }); return yes.includes(result.toLowerCase()); } }