code: public String userInput(String message, String[] validResponses) {
          if (validResponses == null) {
              return userInput(message);
          }
  
          String question = createQuestion(message, validResponses);
          String response = userInput(question);
          for (String validResponse : validResponses) {
              if (validResponse.equalsIgnoreCase(response)) {
                  return response;
              }
          }
          cursorMove = 0;
          return userInput("Invalid input. Must be one of ", validResponses);
      }
docs: Replacement for AntBuilder.input() to eliminate dependency of GrailsScriptRunner on the Ant libraries.
  Prints a message and list of valid responses, then returns whatever the user enters
  (once they press &lt;return&gt;). If the user enters something that is not in the array of valid responses,
  the message is displayed again and the method waits for more input. It will display the message a maximum of
  three times before it gives up and returns <code>null</code>.
  
  @param message        The message/question to display.
  @param validResponses An array of responses that the user is allowed to enter. Displayed after the message.
  @return The line of text entered by the user, or <code>null</code> if the user never entered a valid string.