Package org.jline.reader.impl
Class DefaultParser.ArgumentList
java.lang.Object
org.jline.reader.impl.DefaultParser.ArgumentList
- All Implemented Interfaces:
CompletingParsedLine
,ParsedLine
- Enclosing class:
DefaultParser
The result of a delimited buffer.
-
Constructor Summary
ConstructorsConstructorDescriptionArgumentList
(String line, List<String> words, int wordIndex, int wordCursor, int cursor) Deprecated.ArgumentList
(String line, List<String> words, int wordIndex, int wordCursor, int cursor, String openingQuote, int rawWordCursor, int rawWordLength) -
Method Summary
Modifier and TypeMethodDescriptionint
cursor()
The cursor position within the line.escape
(CharSequence candidate, boolean complete) Escapes a completion candidate according to the parser's quoting and escaping rules.line()
The unparsed line.int
Returns the cursor position within the raw (unprocessed) current word.int
Returns the length of the raw (unprocessed) current word.word()
The current word being completed.int
The cursor position within the current word.int
The index of the current word in the list of words.words()
The list of words.
-
Constructor Details
-
ArgumentList
@Deprecated public ArgumentList(String line, List<String> words, int wordIndex, int wordCursor, int cursor) Deprecated. -
ArgumentList
public ArgumentList(String line, List<String> words, int wordIndex, int wordCursor, int cursor, String openingQuote, int rawWordCursor, int rawWordLength) - Parameters:
line
- the command line being editedwords
- the list of wordswordIndex
- the index of the current word in the list of wordswordCursor
- the cursor position within the current wordcursor
- the cursor position within the lineopeningQuote
- the opening quote (usually '\"' or '\'') or nullrawWordCursor
- the cursor position inside the raw word (i.e. including quotes and escape characters)rawWordLength
- the raw word length, including quotes and escape characters
-
-
Method Details
-
wordIndex
public int wordIndex()Description copied from interface:ParsedLine
The index of the current word in the list of words.- Specified by:
wordIndex
in interfaceParsedLine
- Returns:
- the index of the current word in the list of words
-
word
Description copied from interface:ParsedLine
The current word being completed. If the cursor is after the last word, an empty string is returned.- Specified by:
word
in interfaceParsedLine
- Returns:
- the word being completed or an empty string
-
wordCursor
public int wordCursor()Description copied from interface:ParsedLine
The cursor position within the current word.- Specified by:
wordCursor
in interfaceParsedLine
- Returns:
- the cursor position within the current word
-
words
Description copied from interface:ParsedLine
The list of words.- Specified by:
words
in interfaceParsedLine
- Returns:
- the list of words
-
cursor
public int cursor()Description copied from interface:ParsedLine
The cursor position within the line.- Specified by:
cursor
in interfaceParsedLine
- Returns:
- the cursor position within the line
-
line
Description copied from interface:ParsedLine
The unparsed line.- Specified by:
line
in interfaceParsedLine
- Returns:
- the unparsed line
-
escape
Description copied from interface:CompletingParsedLine
Escapes a completion candidate according to the parser's quoting and escaping rules.This method ensures that special characters in the candidate are properly escaped or quoted according to the syntax rules of the parser, maintaining consistency with the current input line's quoting style.
- Specified by:
escape
in interfaceCompletingParsedLine
- Parameters:
candidate
- the completion candidate that may need escapingcomplete
- true if this is a complete word, false if it's a partial completion- Returns:
- the properly escaped/quoted candidate ready for insertion
-
rawWordCursor
public int rawWordCursor()Description copied from interface:CompletingParsedLine
Returns the cursor position within the raw (unprocessed) current word.Unlike
ParsedLine.wordCursor()
, this method returns the cursor position in the original word text, including any quotes and escape characters.- Specified by:
rawWordCursor
in interfaceCompletingParsedLine
- Returns:
- the cursor position within the raw current word
-
rawWordLength
public int rawWordLength()Description copied from interface:CompletingParsedLine
Returns the length of the raw (unprocessed) current word.This is the length of the original word text, including any quotes and escape characters that may have been removed during parsing.
- Specified by:
rawWordLength
in interfaceCompletingParsedLine
- Returns:
- the length of the raw current word
-