protected Response readYesNo(String message, Response defaultResponse) {
    if (defaultResponse == Response.YES) {
      message += " (" + Response.YES.toUpperPrompt() + "/" + Response.NO.toLowerPrompt() + "): ";
    } else {
      message += " (" + Response.YES.toLowerPrompt() + "/" + Response.NO.toUpperPrompt() + "): ";
    }

    if (!interactionSupported()) {
      return defaultResponse;
    }

    Response response = null;
    do {
      String userInput = interact(message);

      if (StringUtils.isEmpty(userInput)) {
        return defaultResponse;
      }
      response = Response.fromString(userInput);

    } while (response == null);

    return response;
  }
Semi-complete implementation of {@link CliAroundInterceptor} for convenience for implementors.


@since GemFire 7.0
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/AbstractCliAroundInterceptor.java