Class Prompter
java.lang.Object
net.rubygrapefruit.platform.prompts.Prompter
Displays prompts on the terminal to ask the user various kinds of questions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAsks the user a yes/no question.enterPassword(String prompt) Asks the user to enter a password.Asks the user to enter some text.booleanReturnstrueif this prompter can ask the user questions.Asks the user to select an option from a list.
-
Constructor Details
-
Prompter
-
-
Method Details
-
isInteractive
public boolean isInteractive()Returnstrueif this prompter can ask the user questions. -
select
Asks the user to select an option from a list.- Returns:
- The index of the selected option or
nullon end of input. Returns the default option when not interactive.
-
enterText
Asks the user to enter some text.- Returns:
- The text or
nullon end of input. Returns the default value when not interactive.
-
enterPassword
Asks the user to enter a password.- Returns:
- The password or
nullon end of input or when not interactive or when not possible to prompt for a password without echoing the characters.
-
askYesNo
Asks the user a yes/no question.- Returns:
- The selected value or null on end of input. Returns the default value when not interactive.
-