PHP 클래스 Stecman\Component\Symfony\Console\BashCompletion\CompletionContext

Represents the current state of the command line that is being completed
파일 보기 프로젝트 열기: stecman/symfony-console-completion 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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