Package com.google.gerrit.pgm.init.api
Class ConsoleUI
java.lang.Object
com.google.gerrit.pgm.init.api.ConsoleUI
Console based interaction with the invoking user.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static Die
abort()
Constructs an exception indicating the user aborted the operation.void
Display an error message on the system stderr.static ConsoleUI
Get a UI instance, assuming interactive mode.static ConsoleUI
getInstance
(boolean batchMode) Get a UI instance, possibly forcing batch mode.abstract void
Display a header message before a series of prompts.abstract boolean
isBatch()
Returns true if this is a batch UI that has no user interaction.abstract void
Display a message.abstract String
Prompt the user for a password, returning the string; null if blank.Prompt the user to make a choice from an enumeration's values.int
Prompt the user for an integer value, suggesting a default.abstract String
readString
(String def, String fmt, Object... args) Prompt the user for a string, suggesting a default, and returning choice.abstract String
Prompt the user to make a choice from an allowed list of values.abstract void
Prints a message asking the user to let us know when its safe to continue.abstract boolean
Request the user to answer a yes/no question.
-
Constructor Details
-
ConsoleUI
public ConsoleUI()
-
-
Method Details
-
getInstance
Get a UI instance, assuming interactive mode. -
getInstance
Get a UI instance, possibly forcing batch mode. -
abort
Constructs an exception indicating the user aborted the operation. -
isBatch
public abstract boolean isBatch()Returns true if this is a batch UI that has no user interaction. -
header
Display a header message before a series of prompts. -
message
Display a message. -
yesno
Request the user to answer a yes/no question. -
waitForUser
public abstract void waitForUser()Prints a message asking the user to let us know when its safe to continue. -
readString
Prompt the user for a string, suggesting a default, and returning choice. -
readString
public abstract String readString(String def, Set<String> allowedValues, String fmt, Object... args) Prompt the user to make a choice from an allowed list of values. -
readInt
Prompt the user for an integer value, suggesting a default. -
password
Prompt the user for a password, returning the string; null if blank. -
error
Display an error message on the system stderr. -
readEnum
public abstract <T extends Enum<?>,A extends EnumSet<? extends T>> T readEnum(T def, A options, String fmt, Object... args) Prompt the user to make a choice from an enumeration's values.
-