confirm method
Asks a yes/no question.
Implementation
bool confirm(String question, {bool defaultValue = true}) {
final hint = defaultValue ? 'Y/n' : 'y/N';
while (true) {
stdout.write(
'${ColorizeLogger.bold('?')} $question ${ColorizeLogger.dim('($hint)')} ',
);
final answer = _readLine().trim().toLowerCase();
if (answer.isEmpty) return defaultValue;
if (answer == 'y' || answer == 'yes') return true;
if (answer == 'n' || answer == 'no') return false;
_logger.logWarning('answer y or n');
}
}