public class CompletionContext extends Object
Constructor and Description |
---|
CompletionContext(List<String> words,
int wordIndex,
int position,
CommandRegistration commandRegistration,
CommandOption commandOption) |
Modifier and Type | Method and Description |
---|---|
CompletionContext |
commandOption(CommandOption commandOption)
Return a copy of this context with given command option.
|
CompletionContext |
commandRegistration(CommandRegistration commandRegistration)
Return a copy of this context with given command registration.
|
String |
currentWord()
Return the whole word the cursor is in, or
null if the cursor is past the last word. |
String |
currentWordUpToCursor() |
CompletionContext |
drop(int nbWords)
Return a copy of this context, as if the first nbWords were not present
|
CommandOption |
getCommandOption() |
CommandRegistration |
getCommandRegistration() |
int |
getPosition() |
int |
getWordIndex() |
List<String> |
getWords() |
String |
upToCursor() |
public CompletionContext(List<String> words, int wordIndex, int position, CommandRegistration commandRegistration, CommandOption commandOption)
words
- words in the buffer, excluding words for the command namewordIndex
- the index of the word the cursor is inposition
- the position inside the current word where the cursor ispublic int getWordIndex()
public int getPosition()
public CommandOption getCommandOption()
public CommandRegistration getCommandRegistration()
public String upToCursor()
public String currentWord()
null
if the cursor is past the last word.public String currentWordUpToCursor()
public CompletionContext drop(int nbWords)
public CompletionContext commandOption(CommandOption commandOption)
public CompletionContext commandRegistration(CommandRegistration commandRegistration)
Copyright © 2024. All rights reserved.