in daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java [104:129]
String doPrompt(String message, List<Object> possibleValues, String defaultReply, boolean password)
throws PrompterException {
String formattedMessage = formatMessage(message, possibleValues, defaultReply);
String line;
do {
try {
line = doPrompt(formattedMessage, password);
if (line == null && defaultReply == null) {
throw new IOException("EOF");
}
} catch (IOException e) {
throw new PrompterException("Failed to prompt user", e);
}
if (line == null || line.isEmpty()) {
line = defaultReply;
}
if (line != null && (possibleValues != null && !possibleValues.contains(line))) {
try {
doDisplay("Invalid selection.\n");
} catch (IOException e) {
throw new PrompterException("Failed to present feedback", e);
}
}
} while (line == null || (possibleValues != null && !possibleValues.contains(line)));
return line;
}