10000 Zsh shell autocompletions by adhocore · Pull Request #43970 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Zsh shell autocompletions #43970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
Add a way to make completion input aware of shell
  • Loading branch information
adhocore committed Nov 9, 2021
commit 3d38c3954a12de53b8eae42f74df57751a543c26
14 changes: 14 additions & 0 deletions src/Symfony/Component/Console/Completion/CompletionInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* completion is expected.
*
* @author Wouter de Jong <wouter@wouterj.nl>
* @author Jitendra A <adhocore@gmail.com>
*/
final class CompletionInput extends ArgvInput
{
Expand All @@ -32,6 +33,7 @@ final class CompletionInput extends ArgvInput
public const TYPE_NONE = 'none';

private $tokens;
private $shell = '';
private $currentIndex;
private $completionType;
private $completionName = null;
Expand Down Expand Up @@ -179,6 +181,18 @@ public function mustSuggestArgumentValuesFor(string $argumentName): bool
return self::TYPE_ARGUMENT_VALUE === $this->getCompletionType() && $argumentName === $this->getCompletionName();
}

public function setShell(string $shell): string
{
[$this->shell, $old] = [$shell, $this->shell];

return $old;
}

public function isShell(string $shell): bool
{
return $this->shell === $shell;
}

protected function parseToken(string $token, bool $parseOptions): bool
{
try {
Expand Down
0