Class TailTipWidgets
TailTipWidgets provides real-time command line suggestions as the user types, based on command completer data and/or positional argument descriptions. These suggestions are displayed in the terminal's status bar, helping users understand the available options and arguments for commands.
The widgets can be configured to use different suggestion types and display styles, and can be bound to key sequences for manual invocation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration specifying the type of suggestions to display. -
Field Summary
Fields inherited from class org.jline.widget.Widgets
AP_BACKWARD_DELETE_CHAR, AP_INSERT, AUTOPAIR_TOGGLE, AUTOSUGGEST_TOGGLE, reader, TAILTIP_PANE, TAILTIP_TOGGLE, TT_ACCEPT_LINE
-
Constructor Summary
ConstructorsConstructorDescriptionTailTipWidgets
(org.jline.reader.LineReader reader, Function<CmdLine, CmdDesc> descFun, int descriptionSize, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions.TailTipWidgets
(org.jline.reader.LineReader reader, Map<String, CmdDesc> tailTips) Creates tailtip widgets used in command line suggestions.TailTipWidgets
(org.jline.reader.LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize) Creates tailtip widgets used in command line suggestions with a status bar.TailTipWidgets
(org.jline.reader.LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions with a status bar and specific tip type.TailTipWidgets
(org.jline.reader.LineReader reader, Map<String, CmdDesc> tailTips, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions with a specific tip type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears terminal status barvoid
disable()
void
enable()
int
void
Initialize terminal status barboolean
void
setDescriptionCache
(boolean cache) void
setDescriptionSize
(int descriptionSize) void
setTailTips
(Map<String, CmdDesc> tailTips) void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
Methods inherited from class org.jline.widget.Widgets
addWidget, aliasWidget, args, buffer, callWidget, clearTailTip, currChar, destroyDescription, executeWidget, existsWidget, getKeyMap, getWidget, lastBinding, parser, prevChar, putString, replaceBuffer, setDescription, setErrorIndex, setErrorPattern, setSuggestionType, setTailTip, tailTip
-
Constructor Details
-
TailTipWidgets
Creates tailtip widgets used in command line suggestions.This constructor creates widgets that use both positional argument descriptions and completer data for suggestions (TipType.COMBINED). If argument descriptions don't exist, command completer data will be used. No status bar for argument descriptions will be created (descriptionSize = 0).
- Parameters:
reader
- the LineReader instance to associate with these widgetstailTips
- a map of command names to their descriptions, containing options and positional argument information- Throws:
IllegalStateException
- if widgets are already created for the LineReader
-
TailTipWidgets
public TailTipWidgets(org.jline.reader.LineReader reader, Map<String, CmdDesc> tailTips, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions with a specific tip type.This constructor allows specifying which data source to use for suggestions (positional argument descriptions, completer data, or both). No status bar for argument descriptions will be created (descriptionSize = 0).
- Parameters:
reader
- the LineReader instance to associate with these widgetstailTips
- a map of command names to their descriptions, containing options and positional argument informationtipType
- defines which data will be used for suggestions (TAIL_TIP, COMPLETER, or COMBINED)- Throws:
IllegalStateException
- if widgets are already created for the LineReader
-
TailTipWidgets
public TailTipWidgets(org.jline.reader.LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize) Creates tailtip widgets used in command line suggestions with a status bar.This constructor creates widgets that use both positional argument descriptions and completer data for suggestions (TipType.COMBINED). If argument descriptions don't exist, command completer data will be used. A status bar for argument descriptions will be created with the specified size.
- Parameters:
reader
- the LineReader instance to associate with these widgetstailTips
- a map of command names to their descriptions, containing options and positional argument informationdescriptionSize
- the size of the status bar for displaying argument descriptions (0 for no status bar)- Throws:
IllegalStateException
- if widgets are already created for the LineReader
-
TailTipWidgets
public TailTipWidgets(org.jline.reader.LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions with a status bar and specific tip type.This constructor allows full customization of the widgets, specifying both the status bar size and which data source to use for suggestions (positional argument descriptions, completer data, or both).
- Parameters:
reader
- the LineReader instance to associate with these widgetstailTips
- a map of command names to their descriptions, containing options and positional argument informationdescriptionSize
- the size of the status bar for displaying argument descriptions (0 for no status bar)tipType
- defines which data will be used for suggestions (TAIL_TIP, COMPLETER, or COMBINED)- Throws:
IllegalStateException
- if widgets are already created for the LineReader
-
TailTipWidgets
public TailTipWidgets(org.jline.reader.LineReader reader, Function<CmdLine, CmdDesc> descFun, int descriptionSize, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions.- Parameters:
reader
- LineReader.descFun
- Function that returns command description.descriptionSize
- Size of the status bar.tipType
- Defines which data will be used for suggestions.- Throws:
IllegalStateException
- If widgets are already created.
-
-
Method Details
-
setTailTips
-
setDescriptionSize
public void setDescriptionSize(int descriptionSize) -
getDescriptionSize
public int getDescriptionSize() -
setTipType
-
getTipType
-
isEnabled
public boolean isEnabled() -
disable
public void disable() -
enable
public void enable() -
setDescriptionCache
public void setDescriptionCache(boolean cache) -
tailtipComplete
public boolean tailtipComplete() -
tailtipAcceptLine
public boolean tailtipAcceptLine() -
tailtipBackwardDelete
public boolean tailtipBackwardDelete() -
tailtipDelete
public boolean tailtipDelete() -
tailtipKillLine
public boolean tailtipKillLine() -
tailtipKillWholeLine
public boolean tailtipKillWholeLine() -
tailtipInsert
public boolean tailtipInsert() -
tailtipUpdateStatus
public boolean tailtipUpdateStatus() -
initDescription
public void initDescription()Initialize terminal status bar -
clearDescription
public void clearDescription()Description copied from class:Widgets
Clears terminal status bar- Overrides:
clearDescription
in classWidgets
-
toggleWindow
public boolean toggleWindow() -
toggleKeyBindings
public boolean toggleKeyBindings()
-