PHP Class Stecman\Component\Symfony\Console\BashCompletion\CompletionHandler

Afficher le fichier Open project: stecman/symfony-console-completion Class Usage Examples

Protected Properties

Свойство Type Description
$application Symfony\Component\Console\Application Application to complete for
$command Symfony\Component\Console\Command\Command
$context CompletionContext
$helpers Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionInterface[] Array of completion helpers.

Méthodes publiques

Méthode Description
__construct ( Application $application, CompletionContext $context = null )
addHandler ( Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionInterface $helper )
addHandlers ( array $array )
getContext ( ) : CompletionContext
getInput ( ) : Symfony\Component\Console\Input\ArrayInput Get an InputInterface representation of the completion context
runCompletion ( ) : string[] Do the actual completion, returning an array of strings to provide to the parent shell's completion system
setContext ( CompletionContext $context )

Méthodes protégées

Méthode Description
completeForCommandArguments ( ) : array | false Attempt to complete the current word as a command argument value
completeForCommandName ( ) : array | false Attempt to complete the current word as a command name
completeForOptionShortcutValues ( ) : array | false Attempt to complete the current word as the value of an option shortcut
completeForOptionShortcuts ( ) : array | false Attempt to complete the current word as an option shortcut.
completeForOptionValues ( ) : array | false Attemp to complete the current word as the value of a long-form option
completeForOptions ( ) : array | false Attempt to complete the current word as a long-form option (--my-option)
completeOption ( Symfony\Component\Console\Input\InputOption $option ) : array | false Complete the value for the given option if a value completion is availble
filterResults ( array $array ) : string[] Filter out results that don't match the current word on the command line
getAllOptions ( ) : Symfony\Component\Console\Input\InputOption[] Get the combined options of the application and entered command
getCompletionHelper ( string $name, string $type ) : Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionInterface | null Find a CompletionInterface that matches the current command, target name, and target type
getOptionWordsWithValues ( ) : string[] Build a list of option words/flags that will have a value after them Options are returned in the format they appear as on the command line.
mapArgumentsToWords ( Symfony\Component\Console\Input\InputArgument[] $argumentDefinitions ) : array Step through the command line to determine which word positions represent which argument values

Method Details

__construct() public méthode

public __construct ( Application $application, CompletionContext $context = null )
$application Symfony\Component\Console\Application
$context CompletionContext

addHandler() public méthode

public addHandler ( Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionInterface $helper )
$helper Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionInterface

addHandlers() public méthode

public addHandlers ( array $array )
$array array

completeForCommandArguments() protected méthode

Attempt to complete the current word as a command argument value
See also: Symfony\Component\Console\Input\InputArgument
protected completeForCommandArguments ( ) : array | false
Résultat array | false

completeForCommandName() protected méthode

Attempt to complete the current word as a command name
protected completeForCommandName ( ) : array | false
Résultat array | false

completeForOptionShortcutValues() protected méthode

Attempt to complete the current word as the value of an option shortcut
protected completeForOptionShortcutValues ( ) : array | false
Résultat array | false

completeForOptionShortcuts() protected méthode

If the shortcut exists it will be completed, but a list of possible shortcuts is never returned for completion.
protected completeForOptionShortcuts ( ) : array | false
Résultat array | false

completeForOptionValues() protected méthode

Attemp to complete the current word as the value of a long-form option
protected completeForOptionValues ( ) : array | false
Résultat array | false

completeForOptions() protected méthode

Attempt to complete the current word as a long-form option (--my-option)
protected completeForOptions ( ) : array | false
Résultat array | false

completeOption() protected méthode

Complete the value for the given option if a value completion is availble
protected completeOption ( Symfony\Component\Console\Input\InputOption $option ) : array | false
$option Symfony\Component\Console\Input\InputOption
Résultat array | false

filterResults() protected méthode

Filter out results that don't match the current word on the command line
protected filterResults ( array $array ) : string[]
$array array
Résultat string[]

getAllOptions() protected méthode

Get the combined options of the application and entered command
protected getAllOptions ( ) : Symfony\Component\Console\Input\InputOption[]
Résultat Symfony\Component\Console\Input\InputOption[]

getCompletionHelper() protected méthode

Find a CompletionInterface that matches the current command, target name, and target type
protected getCompletionHelper ( string $name, string $type ) : Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionInterface | null
$name string
$type string
Résultat Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionInterface | null

getContext() public méthode

public getContext ( ) : CompletionContext
Résultat CompletionContext

getInput() public méthode

Get an InputInterface representation of the completion context
public getInput ( ) : Symfony\Component\Console\Input\ArrayInput
Résultat Symfony\Component\Console\Input\ArrayInput

getOptionWordsWithValues() protected méthode

Build a list of option words/flags that will have a value after them Options are returned in the format they appear as on the command line.
protected getOptionWordsWithValues ( ) : string[]
Résultat string[] - eg. ['--myoption', '-m', ... ]

mapArgumentsToWords() protected méthode

The word indexes of argument values are found by eliminating words that are known to not be arguments (options, option values, and command names). Any word that doesn't match for elimination is assumed to be an argument value,
protected mapArgumentsToWords ( Symfony\Component\Console\Input\InputArgument[] $argumentDefinitions ) : array
$argumentDefinitions Symfony\Component\Console\Input\InputArgument[]
Résultat array as [argument name => word index on command line]

runCompletion() public méthode

Do the actual completion, returning an array of strings to provide to the parent shell's completion system
public runCompletion ( ) : string[]
Résultat string[]

setContext() public méthode

public setContext ( CompletionContext $context )
$context CompletionContext

Property Details

$application protected_oe property

Application to complete for
protected Application,Symfony\Component\Console $application
Résultat Symfony\Component\Console\Application

$command protected_oe property

protected Command,Symfony\Component\Console\Command $command
Résultat Symfony\Component\Console\Command\Command

$context protected_oe property

protected CompletionContext,Stecman\Component\Symfony\Console\BashCompletion $context
Résultat CompletionContext

$helpers protected_oe property

Array of completion helpers.
protected CompletionInterface[],Stecman\Component\Symfony\Console\BashCompletion\Completion $helpers
Résultat Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionInterface[]