chooseOne<T> method
T
chooseOne<T>(})
override
Prompts user to select one choice from choices.
Implementation
@override
T chooseOne<T>(String message,
{required List<T> choices,
T? defaultValue,
String Function(T)? display}) {
if (_isJsonOutput) return defaultValue ?? choices.first;
// Hack to prevent mason_logger from breaking when choices cause terminal scrolling.
// We pre-allocate the lines to force scrolling before saving the cursor.
final linesNeeded = choices.length + 1;
io.stdout.write('\n' * linesNeeded);
io.stdout.write('\x1B[${linesNeeded}A');
return _logger.chooseOne<T>(message,
choices: choices, defaultValue: defaultValue, display: display);
}