Package org.jline.reader
Interface ParsedLine
- All Known Subinterfaces:
CompletingParsedLine
- All Known Implementing Classes:
ArgumentCompleter.ArgumentLine
,DefaultParser.ArgumentList
public interface ParsedLine
ParsedLine
objects are returned by the Parser
during completion or when accepting the line.
This interface represents a command line that has been tokenized into words according to the syntax rules of the parser. It provides access to the individual words, the current word being completed, cursor positions, and the original unparsed line.
ParsedLine objects are used extensively during tab completion to determine
what the user is trying to complete and to provide the appropriate context
to Completer
implementations.
The instances should implement the CompletingParsedLine
interface so that escape chars and quotes can be correctly handled during
completion.
- See Also:
-
Method Summary
-
Method Details
-
word
String word()The current word being completed. If the cursor is after the last word, an empty string is returned.- Returns:
- the word being completed or an empty string
-
wordCursor
int wordCursor()The cursor position within the current word.- Returns:
- the cursor position within the current word
-
wordIndex
int wordIndex()The index of the current word in the list of words.- Returns:
- the index of the current word in the list of words
-
words
The list of words.- Returns:
- the list of words
-
line
String line()The unparsed line.- Returns:
- the unparsed line
-
cursor
int cursor()The cursor position within the line.- Returns:
- the cursor position within the line
-