Class CompletionContext

java.lang.Object
org.springframework.shell.CompletionContext

public class CompletionContext extends Object
Represents the buffer context in which completion was triggered.
  • Constructor Details

    • CompletionContext

      public CompletionContext(List<String> words, int wordIndex, int position, CommandRegistration commandRegistration, CommandOption commandOption)
      Parameters:
      words - words in the buffer, excluding words for the command name
      wordIndex - the index of the word the cursor is in
      position - the position inside the current word where the cursor is
  • Method Details

    • getWords

      public List<String> getWords()
    • getWordIndex

      public int getWordIndex()
    • getPosition

      public int getPosition()
    • getCommandOption

      public CommandOption getCommandOption()
    • getCommandRegistration

      public CommandRegistration getCommandRegistration()
    • upToCursor

      public String upToCursor()
    • currentWord

      public String currentWord()
      Return the whole word the cursor is in, or null if the cursor is past the last word.
    • currentWordUpToCursor

      public String currentWordUpToCursor()
    • drop

      public CompletionContext drop(int nbWords)
      Return a copy of this context, as if the first nbWords were not present
    • commandOption

      public CompletionContext commandOption(CommandOption commandOption)
      Return a copy of this context with given command option.
    • commandRegistration

      public CompletionContext commandRegistration(CommandRegistration commandRegistration)
      Return a copy of this context with given command registration.