generateChoice function
Generate a formatted choice line
Implementation
String generateChoice(
String name, [
String? description,
bool isDefault = false,
]) {
final sb = StringBuffer();
final star = (isDefault ? ' * ' : '');
String choice = (name + star);
if (description != null) {
choice = choice.padRight(20);
}
sb.write(choice);
if (description != null) {
sb.write(description.truncateChoiceDescription(choice.length));
}
String line = sb.toString();
line = line;
return line;
}