private static String promptForValue(String key, Terminal terminal, boolean secret) { if (terminal == null) { throw new UnsupportedOperationException( "found property [" + key + "] with value [" + (secret ? SECRET_PROMPT_VALUE : TEXT_PROMPT_VALUE) + "]. prompting for property values is only supported when running elasticsearch in the foreground"); } if (secret) { return new String(terminal.readSecret("Enter value for [%s]: ", key)); } return terminal.readText("Enter value for [%s]: ", key); }