Property | Type | Description | |
---|---|---|---|
$charIndex | integer | If the current cursor position is at the end of the current command, the value of this variable is equal to the length of $this->commandLine Bash equivalent: COMP_POINT | |
$commandLine | string | Bash equivalent: COMP_LINE | |
$wordBreaks | string | Bash equivalent: COMP_WORDBREAKS | |
$wordIndex | integer | null | This is not set until $this->splitCommand() is called. Bash equivalent: COMP_CWORD | |
$words | array | null | This is not set until $this->splitCommand() is called, when it is populated by $commandLine exploded by $wordBreaks Bash equivalent: COMP_WORDS |
Method | Description | |
---|---|---|
getCharIndex ( ) : integer | Get the character index of the user's cursor on the command line | |
getCommandLine ( ) : string | Return the current command line verbatim as a string | |
getCurrentWord ( ) : string | Return the word from the command line that the cursor is currently in | |
getWordAtIndex ( integer $index ) : string | Return a word by index from the command line | |
getWordIndex ( ) : integer | Get the index of the word the cursor is currently in | |
getWords ( ) : array | Get the contents of the command line, exploded into words based on the configured word break characters | |
setCharIndex ( integer $index ) | Set the cursor position as a character index relative to the start of the command line | |
setCommandLine ( string $commandLine ) | Set the whole contents of the command line as a string | |
setWordBreaks ( string $charList ) | Set characters to use as split points when breaking the command line into words |
Method | Description | |
---|---|---|
reset ( ) | Reset the computed words so that $this->splitWords is forced to run again | |
splitCommand ( ) : string[] | Split the command line into words using the configured word break characters |
public getCharIndex ( ) : integer | ||
return | integer |
public getCommandLine ( ) : string | ||
return | string |
public getCurrentWord ( ) : string | ||
return | string |
public getWordAtIndex ( integer $index ) : string | ||
$index | integer | |
return | string |
public getWordIndex ( ) : integer | ||
return | integer |
protected reset ( ) |
public setCharIndex ( integer $index ) | ||
$index | integer |
public setCommandLine ( string $commandLine ) | ||
$commandLine | string |
public setWordBreaks ( string $charList ) | ||
$charList | string | - a single string containing all of the characters to break words on |
protected splitCommand ( ) : string[] | ||
return | string[] |
protected int $charIndex | ||
return | integer |
protected string $commandLine | ||
return | string |
protected string $wordBreaks | ||
return | string |