8000 Showcase custom value completion · symfony/symfony@cff89a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit cff89a6

Browse files
committed
Showcase custom value completion
1 parent c750261 commit cff89a6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/SecretsRemoveCommand.php

Copy file name to clipboard
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
use Symfony\Bundle\FrameworkBundle\Secrets\AbstractVault;
1515
use Symfony\Component\Console\Command\Command;
16+
use Symfony\Component\Console\Completion\Completion;
17+
use Symfony\Component\Console\Completion\CompletionInput;
1618
use Symfony\Component\Console\Input\InputArgument;
1719
use Symfony\Component\Console\Input\InputInterface;
1820
use Symfony\Component\Console\Input\InputOption;
@@ -80,4 +82,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8082

8183
return 0;
8284
}
85+
86+
public function complete(CompletionInput $input, Completion $completion): void
87+
{
88+
if (
89+
CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
90+
&& 'name' === $input->getCompletionName()
91+
) {
92+
$vault = $input->getOption('local') ? $this->localVault : $this->vault;
93+
$completion->suggestValues(array_keys($this->vault->list(false)));
94+
95+
return;
96+
}
97+
98+
parent::complete($input, $completion);
99+
}
83100
}

0 commit comments

Comments
 (0)
0