lucee.Componentcommandbox.system.util.jline.ArgumentList
Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com JLine parsed argument list
Constructor Summary | |
---|---|
init([string line], [numeric cursor], [array tokens], [any context])
|
Method Summary | |
---|---|
any
|
cursor()
The cursor position within the line. |
any
|
escape([string candidate], [boolean complete])
Escapes a completion candidate before writing it to the buffer - this method can be used. |
any
|
line()
The unparsed line. |
private any
|
namedParam([any token])
|
any
|
rawWordCursor()
The cursor position within the current word in its raw (quoted and escaped) form. |
any
|
rawWordLength()
The length of the current word in its raw (quoted and escaped) form. |
private any
|
token()
|
private any
|
unquote([any token])
|
any
|
word()
This is the word the cursor is currently in - for our purposes it is always the last word. |
any
|
wordCursor()
The cursor position within the current word (unquoted, unescaped). |
any
|
wordIndex()
The index of the current word (the word the cursor is in) in the list of words. |
any
|
words()
The parsed list of words in the raw line. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
line
- the raw line from the buffercursor
- the position of the cursor on the linetokens
- the array of parsed tokens from the CommandBox Parsercontext
- ParseContext enum from org.jline.reader.Parser - can be UNSPECIFIED, ACCEPT_LINE, COMPLETE, SECONDARY_PROMPTMethod Detail |
---|
The cursor position within the line This was passed into the parse function
Escapes a completion candidate before writing it to the buffer - this method can be used to quote completions that contain spaces. JLine will also use this method to backspace the current word from the buffer - not sure why it uses this in certain cases instead of the `rawWordXXXX()` methods above. But since it does, this method can be used to ensure the correct number of characters are removed. `complete` will generally match up with whether completion candidates are marked as complete, however, when choosing from a menu this is hard coded as true, and when backspacing the current word it is hard coded as false. So this needs to be worked around for now.
candidate
- a string containing a completion candidate to be escaped - might also be the current word so Jline can backspace itcomplete
- a boolean indicating whether this completion candidate is considered completeThe unparsed line This was passed into the parse function
token
The cursor position within the current word in its raw (quoted and escaped) form JLine uses this to correctly backspace the current word on the raw line when writing a completion to the buffer. This is not currently computed so just return the length of the current token
The length of the current word in its raw (quoted and escaped) form JLine uses this to correctly backspace the current word on the raw line when writing a completion to the buffer.
token
This is the word the cursor is currently in - for our purposes it is always the last word. In order for quoted completions to work, this is expected to have any quotes wrapping the word stripped. (JLine also expects it to have escapes removed, but for our purposes unquoting seems sufficent.)
The cursor position within the current word (unquoted, unescaped) This is not currently computed so just return the length of the current word
The index of the current word (the word the cursor is in) in the list of words The last word is regarded as always being the current word for now
The parsed list of words in the raw line This is the array of tokens that were computed by our parser and passed in - with one difference. Completions in CommandBox are always done with respect to the last word on the line, so that word needs to be unquoted for JLine so it can match completions correctly.