Package org.jline.widget
Class TailTipWidgets
java.lang.Object
org.jline.widget.Widgets
org.jline.widget.TailTipWidgets
Creates and manages widgets for as you type command line suggestions.
Suggestions are created using a command completer data and/or positional argument descriptions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class(package private) static classstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TailTipWidgets.CommandDescriptionsprivate booleanprivate booleanprivate intprivate booleanprivate Objectprivate TailTipWidgets.TipTypeFields 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
ConstructorsModifierConstructorDescriptionTailTipWidgets(LineReader reader, Function<CmdLine, CmdDesc> descFun, int descriptionSize, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions.TailTipWidgets(LineReader reader, Map<String, CmdDesc> tailTips) Creates tailtip widgets used in command line suggestions.TailTipWidgets(LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize) Creates tailtip widgets used in command line suggestions.TailTipWidgets(LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions.privateTailTipWidgets(LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType, Function<CmdLine, CmdDesc> descFun) TailTipWidgets(LineReader reader, Map<String, CmdDesc> tailTips, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanprivate booleanclearTailTip(String widget) private List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descriptionSize) private List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descriptionSize, String lastArg) private List<AttributedString> compileOptionDescription(CmdDesc cmdDesc, String opt, int descriptionSize) private voidprivate booleanvoiddisable()private voiddoCommandTailTip(String widget, CmdDesc cmdDesc, List<String> args) private voiddoDescription(List<AttributedString> desc) private booleanvoidenable()intbooleanprivate voidvoidsetDescriptionCache(boolean cache) voidsetDescriptionSize(int descriptionSize) voidsetTailTips(Map<String, CmdDesc> tailTips) voidbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanMethods inherited from class org.jline.widget.Widgets
addDescription, addWidget, aliasWidget, args, buffer, callWidget, clearDescription, clearTailTip, currChar, destroyDescription, executeWidget, existsWidget, getKeyMap, getWidget, initDescription, lastBinding, parser, prevChar, putString, replaceBuffer, setErrorIndex, setErrorPattern, setSuggestionType, setTailTip, tailTip
-
Field Details
-
enabled
private boolean enabled -
cmdDescs
-
tipType
-
descriptionSize
private int descriptionSize -
descriptionEnabled
private boolean descriptionEnabled -
descriptionCache
private boolean descriptionCache -
readerErrors
-
-
Constructor Details
-
TailTipWidgets
Creates tailtip widgets used in command line suggestions. Suggestions are created using a command positional argument names. If argument descriptions do not exists command completer data will be used. Status bar for argument descriptions will not be created.- Parameters:
reader- LineReader.tailTips- Commands options and positional argument descriptions.- Throws:
IllegalStateException- If widgets are already created.
-
TailTipWidgets
public TailTipWidgets(LineReader reader, Map<String, CmdDesc> tailTips, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions. Status bar for argument descriptions will not be created.- Parameters:
reader- LineReader.tailTips- Commands options and positional argument descriptions.tipType- Defines which data will be used for suggestions.- Throws:
IllegalStateException- If widgets are already created.
-
TailTipWidgets
Creates tailtip widgets used in command line suggestions. Suggestions are created using a command positional argument names. If argument descriptions do not exists command completer data will be used.- Parameters:
reader- LineReader.tailTips- Commands options and positional argument descriptions.descriptionSize- Size of the status bar.- Throws:
IllegalStateException- If widgets are already created.
-
TailTipWidgets
public TailTipWidgets(LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType) Creates tailtip widgets used in command line suggestions.- Parameters:
reader- LineReader.tailTips- Commands options and positional argument descriptions.descriptionSize- Size of the status bar.tipType- Defines which data will be used for suggestions.- Throws:
IllegalStateException- If widgets are already created.
-
TailTipWidgets
public TailTipWidgets(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.
-
TailTipWidgets
private TailTipWidgets(LineReader reader, Map<String, CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType, Function<CmdLine, CmdDesc> descFun)
-
-
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() -
clearTailTip
-
tailtipDelete
public boolean tailtipDelete() -
tailtipKillLine
public boolean tailtipKillLine() -
tailtipKillWholeLine
public boolean tailtipKillWholeLine() -
tailtipInsert
public boolean tailtipInsert() -
tailtipUpdateStatus
public boolean tailtipUpdateStatus() -
doTailTip
-
doCommandTailTip
-
resetTailTip
private void resetTailTip() -
doDescription
-
autopairEnabled
private boolean autopairEnabled() -
toggleWindow
public boolean toggleWindow() -
toggleKeyBindings
public boolean toggleKeyBindings() -
defaultBindings
private boolean defaultBindings() -
customBindings
private void customBindings() -
compileMainDescription
-
compileMainDescription
private List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descriptionSize, String lastArg) -
compileOptionDescription
private List<AttributedString> compileOptionDescription(CmdDesc cmdDesc, String opt, int descriptionSize)
-