select static method
Display a selection prompt
Implementation
static String select(String question, List<String> options) {
stdout.writeln('\x1B[36m?\x1B[0m $question');
stdout.writeln('');
for (var i = 0; i < options.length; i++) {
menuOption('${i + 1}', options[i]);
}
stdout.writeln('');
while (true) {
final response = prompt('Select an option (1-${options.length})');
final index = int.tryParse(response);
if (index != null && index > 0 && index <= options.length) {
return options[index - 1];
}
error('Invalid selection. Please try again.');
}
}