PHP Класс Stecman\Component\Symfony\Console\BashCompletion\CompletionContext

Represents the current state of the command line that is being completed
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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

Описание методов

getCharIndex() публичный Метод

This is in the context of the full command line string, so includes word break characters. Note that some shells can only provide an approximation for character index. Under ZSH for example, this will always be the character at the start of the current word.
public getCharIndex ( ) : integer
Результат integer

getCommandLine() публичный Метод

Return the current command line verbatim as a string
public getCommandLine ( ) : string
Результат string

getCurrentWord() публичный Метод

Most of the time this will be a partial word. If the cursor has a space before it, this will return an empty string, indicating a new word.
public getCurrentWord ( ) : string
Результат string

getWordAtIndex() публичный Метод

Return a word by index from the command line
public getWordAtIndex ( integer $index ) : string
$index integer
Результат string

getWordIndex() публичный Метод

Get the index of the word the cursor is currently in
public getWordIndex ( ) : integer
Результат integer

getWords() публичный Метод

Get the contents of the command line, exploded into words based on the configured word break characters
public getWords ( ) : array
Результат array

reset() защищенный Метод

Reset the computed words so that $this->splitWords is forced to run again
protected reset ( )

setCharIndex() публичный Метод

Set the cursor position as a character index relative to the start of the command line
public setCharIndex ( integer $index )
$index integer

setCommandLine() публичный Метод

Set the whole contents of the command line as a string
public setCommandLine ( string $commandLine )
$commandLine string

setWordBreaks() публичный Метод

This defaults to a sane value based on BASH's word break characters and shouldn't need to be changed unless your completions contain the default word break characters.
См. также: wordBreaks
public setWordBreaks ( string $charList )
$charList string - a single string containing all of the characters to break words on

splitCommand() защищенный Метод

Split the command line into words using the configured word break characters
protected splitCommand ( ) : string[]
Результат string[]

Описание свойств

$charIndex защищенное свойство

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
protected int $charIndex
Результат integer

$commandLine защищенное свойство

Bash equivalent: COMP_LINE
protected string $commandLine
Результат string

$wordBreaks защищенное свойство

Bash equivalent: COMP_WORDBREAKS
protected string $wordBreaks
Результат string

$wordIndex защищенное свойство

This is not set until $this->splitCommand() is called. Bash equivalent: COMP_CWORD
protected int|null $wordIndex
Результат integer | null

$words защищенное свойство

This is not set until $this->splitCommand() is called, when it is populated by $commandLine exploded by $wordBreaks Bash equivalent: COMP_WORDS
protected array|null $words
Результат array | null