Copied!

An input specialized for shell completion.

This input allows unfinished option names or values and exposes what kind of completion is expected.

CloneableFinalInstantiable
Constants
public Symfony\Component\Console\Completion\CompletionInput::TYPE_ARGUMENT_VALUE = 'argument_value'
public Symfony\Component\Console\Completion\CompletionInput::TYPE_NONE = 'none'
public Symfony\Component\Console\Completion\CompletionInput::TYPE_OPTION_NAME = 'option_name'
public Symfony\Component\Console\Completion\CompletionInput::TYPE_OPTION_VALUE = 'option_value'
Methods
public Symfony\Component\Console\Input\ArgvInput::__construct(?array $argv = NULL, ?Symfony\Component\Console\Input\InputDefinition $definition = NULL)
 
  • param list<string>|null $argv
public __toString() : string
public bind(Symfony\Component\Console\Input\InputDefinition $definition) : void
public Symfony\Component\Console\Input\Input::escapeToken(string $token) : string
 

Escapes a token through escapeshellarg if it contains unsafe chars.

public static fromString(string $inputStr, int $currentIndex) : self
 

Converts a terminal string into tokens.

This is required for shell completions without COMP_WORDS support.

public static fromTokens(array $tokens, int $currentIndex) : self
 

Create an input based on an COMP_WORDS token list.

  • param string[] $tokens the set of split tokens (e.g. COMP_WORDS or argv)
  • param int $currentIndex the index of the cursor (e.g. COMP_CWORD)
public Symfony\Component\Console\Input\Input::getArgument(string $name) : ?mixed
public Symfony\Component\Console\Input\Input::getArguments() : array
public getCompletionName() : ?string
 

The name of the input option or argument when completing a value.

  • return string|null returns null when completing an option name
public getCompletionType() : string
 

Returns the type of completion required.

TYPE_ARGUMENT_VALUE when completing the value of an input argument TYPE_OPTION_VALUE when completing the value of an input option TYPE_OPTION_NAME when completing the name of an input option TYPE_NONE when nothing should be completed

TYPE_OPTION_NAME and TYPE_NONE are already implemented by the Console component.

  • return self::TYPE_*
public getCompletionValue() : string
 

The value already typed by the user (or empty string).

public Symfony\Component\Console\Input\ArgvInput::getFirstArgument() : ?string
public Symfony\Component\Console\Input\Input::getOption(string $name) : ?mixed
public Symfony\Component\Console\Input\Input::getOptions() : array
public Symfony\Component\Console\Input\ArgvInput::getParameterOption(array|string $values, array|string|int|float|bool|?null $default = false, bool $onlyParams = false) : ?mixed
public Symfony\Component\Console\Input\ArgvInput::getRawTokens(bool $strip = false) : array
 

Returns un-parsed and not validated tokens.

  • param bool $strip Whether to return the raw parameters (false) or the values after the command name (true)
  • return list<string>
public Symfony\Component\Console\Input\Input::getStream()
 
  • return resource
public Symfony\Component\Console\Input\Input::hasArgument(string $name) : bool
public Symfony\Component\Console\Input\Input::hasOption(string $name) : bool
public Symfony\Component\Console\Input\ArgvInput::hasParameterOption(array|string $values, bool $onlyParams = false) : bool
public Symfony\Component\Console\Input\Input::isInteractive() : bool
public mustSuggestArgumentValuesFor(string $argumentName) : bool
public mustSuggestOptionValuesFor(string $optionName) : bool
public Symfony\Component\Console\Input\Input::setArgument(string $name, ?mixed $value) : void
public Symfony\Component\Console\Input\Input::setInteractive(bool $interactive) : void
public Symfony\Component\Console\Input\Input::setOption(string $name, ?mixed $value) : void
public Symfony\Component\Console\Input\Input::setStream( $stream) : void
 
  • param resource $stream
public Symfony\Component\Console\Input\Input::validate() : void
Properties
protected array Symfony\Component\Console\Input\Input::$arguments = []
protected Symfony\Component\Console\Input\InputDefinition Symfony\Component\Console\Input\Input::$definition
protected bool Symfony\Component\Console\Input\Input::$interactive = true
protected array Symfony\Component\Console\Input\Input::$options = []
protected Symfony\Component\Console\Input\Input::$stream = NULL
 
  • var resource
Methods
protected Symfony\Component\Console\Input\ArgvInput::parse() : void
protected parseToken(string $token, bool $parseOptions) : bool
protected Symfony\Component\Console\Input\ArgvInput::setTokens(array $tokens) : void
 
  • param list<string> $tokens
Properties
private ?string $completionName = NULL
private string $completionType
private string $completionValue = ''
private int $currentIndex
private array $tokens
Methods
private getOptionFromToken(string $optionToken) : ?Symfony\Component\Console\Input\InputOption
private getRelevantToken() : string
 

The token of the cursor, or the last token if the cursor is at the end of the input.

private isCursorFree() : bool
 

Whether the cursor is "free" (i.e. at the end of the input preceded by a space).

Methods
public static fromString(string $inputStr, int $currentIndex) : self
 

Converts a terminal string into tokens.

This is required for shell completions without COMP_WORDS support.

public static fromTokens(array $tokens, int $currentIndex) : self
 

Create an input based on an COMP_WORDS token list.

  • param string[] $tokens the set of split tokens (e.g. COMP_WORDS or argv)
  • param int $currentIndex the index of the cursor (e.g. COMP_CWORD)
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration