java.lang.Object
org.jline.consoleui.prompt.ConsolePrompt
Deprecated, for removal: This API element is subject to removal in a future version.
ConsolePrompt encapsulates the prompting of a list of input questions for the user.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated, for removal: This API element is subject to removal in a future version.This class is deprecated along with ConsolePrompt. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.jline.terminal.AttributesDeprecated, for removal: This API element is subject to removal in a future version.protected final ConsolePrompt.UiConfigDeprecated, for removal: This API element is subject to removal in a future version.protected final org.jline.utils.DisplayDeprecated, for removal: This API element is subject to removal in a future version.protected List<org.jline.utils.AttributedString> Deprecated, for removal: This API element is subject to removal in a future version.protected final org.jline.reader.LineReaderDeprecated, for removal: This API element is subject to removal in a future version.protected final org.jline.terminal.TerminalDeprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorsConstructorDescriptionConsolePrompt(org.jline.reader.LineReader reader, org.jline.terminal.Terminal terminal, ConsolePrompt.UiConfig config) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.PrompterFactory#create(org.jline.reader.LineReader, org.jline.terminal.Terminal, org.jline.prompt.PrompterConfig)ConsolePrompt(org.jline.terminal.Terminal terminal) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.PrompterFactory#create(org.jline.terminal.Terminal)ConsolePrompt(org.jline.terminal.Terminal terminal, ConsolePrompt.UiConfig config) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.PrompterFactory#create(org.jline.terminal.Terminal, org.jline.prompt.PrompterConfig) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclose()Deprecated, for removal: This API element is subject to removal in a future version.Exits raw mode and restores the terminal to its previous state.static intcomputePageSize(org.jline.terminal.Terminal terminal, int pageSize, PageSizeType sizeType) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated along with the ConsolePrompt class.protected org.jline.utils.AttributedStringBuildercreateMessage(String message, String response) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#newBuilder()protected voidopen()Deprecated, for removal: This API element is subject to removal in a future version.prompt(Function<Map<String, PromptResultItemIF>, List<PromptableElementIF>> promptableElementLists) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#prompt(java.util.List, java.util.function.Function)prompt(List<PromptableElementIF> promptableElementList) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#prompt(java.util.List, java.util.List)prompt(List<org.jline.utils.AttributedString> headerIn, Function<Map<String, PromptResultItemIF>, List<PromptableElementIF>> promptableElementLists) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#prompt(java.util.List, java.util.function.Function)prompt(List<org.jline.utils.AttributedString> header, List<PromptableElementIF> promptableElementList) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#prompt(java.util.List, java.util.List)protected voidprompt(List<org.jline.utils.AttributedString> headerIn, List<PromptableElementIF> promptableElementList, Map<String, PromptResultItemIF> resultMap) Deprecated, for removal: This API element is subject to removal in a future version.Prompt a list of choices (questions).protected PromptResultItemIFpromptElement(List<org.jline.utils.AttributedString> header, PromptableElementIF pe, PromptResultItemIF oldResult) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
reader
protected final org.jline.reader.LineReader readerDeprecated, for removal: This API element is subject to removal in a future version. -
terminal
protected final org.jline.terminal.Terminal terminalDeprecated, for removal: This API element is subject to removal in a future version. -
display
protected final org.jline.utils.Display displayDeprecated, for removal: This API element is subject to removal in a future version. -
config
Deprecated, for removal: This API element is subject to removal in a future version. -
attributes
protected org.jline.terminal.Attributes attributesDeprecated, for removal: This API element is subject to removal in a future version. -
header
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
ConsolePrompt
@Deprecated(since="4.0.0", forRemoval=true) public ConsolePrompt(org.jline.terminal.Terminal terminal) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.PrompterFactory#create(org.jline.terminal.Terminal)- Parameters:
terminal- the terminal.
-
ConsolePrompt
@Deprecated(since="4.0.0", forRemoval=true) public ConsolePrompt(org.jline.terminal.Terminal terminal, ConsolePrompt.UiConfig config) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.PrompterFactory#create(org.jline.terminal.Terminal, org.jline.prompt.PrompterConfig)- Parameters:
terminal- the terminal.config- ConsolePrompt cursor pointer and checkbox configuration
-
ConsolePrompt
@Deprecated(since="4.0.0", forRemoval=true) public ConsolePrompt(org.jline.reader.LineReader reader, org.jline.terminal.Terminal terminal, ConsolePrompt.UiConfig config) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.PrompterFactory#create(org.jline.reader.LineReader, org.jline.terminal.Terminal, org.jline.prompt.PrompterConfig)- Parameters:
reader- the lineReader.terminal- the terminal.config- ConsolePrompt cursor pointer and checkbox configuration
-
-
Method Details
-
open
protected void open()Deprecated, for removal: This API element is subject to removal in a future version. -
close
protected void close()Deprecated, for removal: This API element is subject to removal in a future version.Exits raw mode and restores the terminal to its previous state.If the terminal is currently in raw mode, this updates the displayed header, restores the saved terminal attributes, disables keypad local mode, emits a newline to the terminal, and clears the saved raw-mode attributes.
-
prompt
@Deprecated(since="4.0.0", forRemoval=true) public Map<String,PromptResultItemIF> prompt(List<PromptableElementIF> promptableElementList) throws IOException, org.jline.reader.UserInterruptException Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#prompt(java.util.List, java.util.List)Prompt a list of choices (questions). This method takes a list of promptable elements, typically created withPromptBuilder. Each of the elements is processed and the user entries and answers are filled in to the result map. The result map contains the key of each promptable element and the user entry as an object implementingPromptResultItemIF.- Parameters:
promptableElementList- the list of questions / prompts to ask the user for.- Returns:
- a map containing a result for each element of promptableElementList
- Throws:
IOException- may be thrown by terminalorg.jline.reader.UserInterruptException- if user interrupt handling is enabled and the user types the interrupt character (ctrl-C)
-
prompt
@Deprecated(since="4.0.0", forRemoval=true) public Map<String,PromptResultItemIF> prompt(List<org.jline.utils.AttributedString> header, List<PromptableElementIF> promptableElementList) throws IOException, org.jline.reader.UserInterruptException Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#prompt(java.util.List, java.util.List)Prompt a list of choices (questions). This method takes a list of promptable elements, typically created withPromptBuilder. Each of the elements is processed and the user entries and answers are filled in to the result map. The result map contains the key of each promptable element and the user entry as an object implementingPromptResultItemIF.- Parameters:
header- info to be displayed before first prompt.promptableElementList- the list of questions / prompts to ask the user for.- Returns:
- a map containing a result for each element of promptableElementList
- Throws:
IOException- may be thrown by terminalorg.jline.reader.UserInterruptException- if user interrupt handling is enabled and the user types the interrupt character (ctrl-C)
-
prompt
@Deprecated(since="4.0.0", forRemoval=true) public Map<String,PromptResultItemIF> prompt(Function<Map<String, PromptResultItemIF>, throws IOExceptionList<PromptableElementIF>> promptableElementLists) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#prompt(java.util.List, java.util.function.Function)Prompt a list of choices (questions). This method takes a function that given a map of interim results returns a list of promptable elements (typically created withPromptBuilder). Each list is then passed toprompt(List, List, Map)and the result added to the map of interim results. The function is then called again with the updated map of results until the function returns null. The final result map contains the key of each promptable element and the user entry as an object implementingPromptResultItemIF.- Parameters:
promptableElementLists- a function returning lists of questions / prompts to ask the user for.- Throws:
IOException- may be thrown by terminal
-
prompt
@Deprecated(since="4.0.0", forRemoval=true) public Map<String,PromptResultItemIF> prompt(List<org.jline.utils.AttributedString> headerIn, Function<Map<String, PromptResultItemIF>, throws IOExceptionList<PromptableElementIF>> promptableElementLists) Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#prompt(java.util.List, java.util.function.Function)Prompt a list of choices (questions). This method takes a function that given a map of interim results returns a list of promptable elements (typically created withPromptBuilder). Each list is then passed toprompt(List, List, Map)and the result added to the map of interim results. The function is then called again with the updated map of results until the function returns null. The final result map contains the key of each promptable element and the user entry as an object implementingPromptResultItemIF.- Parameters:
headerIn- info to be displayed before first prompt.promptableElementLists- a function returning lists of questions / prompts to ask the user for.- Throws:
IOException- may be thrown by terminal
-
prompt
protected void prompt(List<org.jline.utils.AttributedString> headerIn, List<PromptableElementIF> promptableElementList, Map<String, PromptResultItemIF> resultMap) throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.Prompt a list of choices (questions). This method takes a list of promptable elements, typically created withPromptBuilder. Each of the elements is processed and the user entries and answers are filled in to the result map. The result map contains the key of each promptable element and the user entry as an object implementingPromptResultItemIF.- Parameters:
headerIn- info to be displayed before first prompt.promptableElementList- the list of questions / prompts to ask the user for.resultMap- a map containing a result for each element of promptableElementList- Throws:
IOException- may be thrown by terminal
-
promptElement
protected PromptResultItemIF promptElement(List<org.jline.utils.AttributedString> header, PromptableElementIF pe, PromptResultItemIF oldResult) Deprecated, for removal: This API element is subject to removal in a future version. -
createMessage
Deprecated, for removal: This API element is subject to removal in a future version. -
computePageSize
@Deprecated(since="4.0.0", forRemoval=true) public static int computePageSize(org.jline.terminal.Terminal terminal, int pageSize, PageSizeType sizeType) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated along with the ConsolePrompt class. Use the new jline-prompt module instead.Compute the number of terminal rows to use for paginated prompts.- Parameters:
terminal- the terminal from which to read the current row countpageSize- whensizeTypeis ABSOLUTE, the requested number of rows; when treated as a percentage, the requested percent (0-100)sizeType- determines whetherpageSizeis an absolute row count or a percentage of terminal rows- Returns:
- the computed page size in rows; for ABSOLUTE, the smaller of the terminal's row count and
pageSize; otherwisepageSizepercent of the terminal's rows
-
getPromptBuilder
Deprecated, for removal: This API element is subject to removal in a future version.Useinstead.invalid reference
org.jline.prompt.Prompter#newBuilder()Creates aPromptBuilder.- Returns:
- a new prompt builder object.
-
jline-promptmodule instead, which provides a cleaner, interface-based API. Useinvalid reference
invalid reference
Migration example: