Package org.jline.widget
Class TailTipWidgets
- java.lang.Object
-
- org.jline.widget.Widgets
-
- org.jline.widget.TailTipWidgets
-
public class TailTipWidgets extends Widgets
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 Classes Modifier and Type Class Description private class
TailTipWidgets.CommandDescriptions
(package private) static class
TailTipWidgets.Pair<U,V>
static class
TailTipWidgets.TipType
-
Field Summary
Fields Modifier and Type Field Description private TailTipWidgets.CommandDescriptions
cmdDescs
private boolean
descriptionCache
private boolean
descriptionEnabled
private int
descriptionSize
private boolean
enabled
private java.lang.Object
readerErrors
private TailTipWidgets.TipType
tipType
-
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
Constructors Modifier Constructor Description TailTipWidgets(LineReader reader, java.util.function.Function<CmdLine,CmdDesc> descFun, int descriptionSize, TailTipWidgets.TipType tipType)
Creates tailtip widgets used in command line suggestions.TailTipWidgets(LineReader reader, java.util.Map<java.lang.String,CmdDesc> tailTips)
Creates tailtip widgets used in command line suggestions.TailTipWidgets(LineReader reader, java.util.Map<java.lang.String,CmdDesc> tailTips, int descriptionSize)
Creates tailtip widgets used in command line suggestions.TailTipWidgets(LineReader reader, java.util.Map<java.lang.String,CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType)
Creates tailtip widgets used in command line suggestions.private
TailTipWidgets(LineReader reader, java.util.Map<java.lang.String,CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType, java.util.function.Function<CmdLine,CmdDesc> descFun)
TailTipWidgets(LineReader reader, java.util.Map<java.lang.String,CmdDesc> tailTips, TailTipWidgets.TipType tipType)
Creates tailtip widgets used in command line suggestions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
autopairEnabled()
private boolean
clearTailTip(java.lang.String widget)
private java.util.List<AttributedString>
compileMainDescription(CmdDesc cmdDesc, int descriptionSize)
private java.util.List<AttributedString>
compileMainDescription(CmdDesc cmdDesc, int descriptionSize, java.lang.String lastArg)
private java.util.List<AttributedString>
compileOptionDescription(CmdDesc cmdDesc, java.lang.String opt, int descriptionSize)
private void
customBindings()
private boolean
defaultBindings()
void
disable()
private void
doCommandTailTip(java.lang.String widget, CmdDesc cmdDesc, java.util.List<java.lang.String> args)
private void
doDescription(java.util.List<AttributedString> desc)
private boolean
doTailTip(java.lang.String widget)
void
enable()
int
getDescriptionSize()
TailTipWidgets.TipType
getTipType()
boolean
isEnabled()
private void
resetTailTip()
void
setDescriptionCache(boolean cache)
void
setDescriptionSize(int descriptionSize)
void
setTailTips(java.util.Map<java.lang.String,CmdDesc> tailTips)
void
setTipType(TailTipWidgets.TipType type)
boolean
tailtipAcceptLine()
boolean
tailtipBackwardDelete()
boolean
tailtipComplete()
boolean
tailtipDelete()
boolean
tailtipInsert()
boolean
tailtipKillLine()
boolean
tailtipKillWholeLine()
boolean
tailtipUpdateStatus()
boolean
toggleKeyBindings()
boolean
toggleWindow()
-
Methods 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 Detail
-
enabled
private boolean enabled
-
cmdDescs
private final TailTipWidgets.CommandDescriptions cmdDescs
-
tipType
private TailTipWidgets.TipType tipType
-
descriptionSize
private int descriptionSize
-
descriptionEnabled
private boolean descriptionEnabled
-
descriptionCache
private boolean descriptionCache
-
readerErrors
private java.lang.Object readerErrors
-
-
Constructor Detail
-
TailTipWidgets
public TailTipWidgets(LineReader reader, java.util.Map<java.lang.String,CmdDesc> tailTips)
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:
java.lang.IllegalStateException
- If widgets are already created.
-
TailTipWidgets
public TailTipWidgets(LineReader reader, java.util.Map<java.lang.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:
java.lang.IllegalStateException
- If widgets are already created.
-
TailTipWidgets
public TailTipWidgets(LineReader reader, java.util.Map<java.lang.String,CmdDesc> tailTips, int descriptionSize)
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:
java.lang.IllegalStateException
- If widgets are already created.
-
TailTipWidgets
public TailTipWidgets(LineReader reader, java.util.Map<java.lang.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:
java.lang.IllegalStateException
- If widgets are already created.
-
TailTipWidgets
public TailTipWidgets(LineReader reader, java.util.function.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:
java.lang.IllegalStateException
- If widgets are already created.
-
TailTipWidgets
private TailTipWidgets(LineReader reader, java.util.Map<java.lang.String,CmdDesc> tailTips, int descriptionSize, TailTipWidgets.TipType tipType, java.util.function.Function<CmdLine,CmdDesc> descFun)
-
-
Method Detail
-
setTailTips
public void setTailTips(java.util.Map<java.lang.String,CmdDesc> tailTips)
-
setDescriptionSize
public void setDescriptionSize(int descriptionSize)
-
getDescriptionSize
public int getDescriptionSize()
-
setTipType
public void setTipType(TailTipWidgets.TipType type)
-
getTipType
public TailTipWidgets.TipType 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
private boolean clearTailTip(java.lang.String widget)
-
tailtipDelete
public boolean tailtipDelete()
-
tailtipKillLine
public boolean tailtipKillLine()
-
tailtipKillWholeLine
public boolean tailtipKillWholeLine()
-
tailtipInsert
public boolean tailtipInsert()
-
tailtipUpdateStatus
public boolean tailtipUpdateStatus()
-
doTailTip
private boolean doTailTip(java.lang.String widget)
-
doCommandTailTip
private void doCommandTailTip(java.lang.String widget, CmdDesc cmdDesc, java.util.List<java.lang.String> args)
-
resetTailTip
private void resetTailTip()
-
doDescription
private void doDescription(java.util.List<AttributedString> desc)
-
autopairEnabled
private boolean autopairEnabled()
-
toggleWindow
public boolean toggleWindow()
-
toggleKeyBindings
public boolean toggleKeyBindings()
-
defaultBindings
private boolean defaultBindings()
-
customBindings
private void customBindings()
-
compileMainDescription
private java.util.List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descriptionSize)
-
compileMainDescription
private java.util.List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descriptionSize, java.lang.String lastArg)
-
compileOptionDescription
private java.util.List<AttributedString> compileOptionDescription(CmdDesc cmdDesc, java.lang.String opt, int descriptionSize)
-
-