public static boolean yesNoPrompt(String question) {
    if (System.console() == null) {
      throw new IllegalStateException("Script must be run from a terminal to support user prompts");
    }
    while (true) {
      String line = System.console().readLine("%s (y[es]/n[o]): ", question);
      switch (line.toLowerCase()) {
        case "yes":
        case "y":
          return true;
        case "no":
        case "n":
          return false;
        default:
          System.out.println("Please enter either yes, y, no, or n");
      }
    }
  }
Provide a yes/no prompt to the user for interactive scripts.
@param question the question to include in the prompt.
@return {@code true} if the user responded with "yes" or "y", or {@code false} if the user responded with "no" or
        "n".
ambry-tools/src/main/java/com/github/ambry/tools/util/ToolUtils.java