Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7810d19

Browse filesBrowse files
committed
[FrameworkBundle] Add CLI completion to secrets:remove
1 parent ee3ee65 commit 7810d19
Copy full SHA for 7810d19

File tree

1 file changed

+15
-1
lines changed
Filter options

1 file changed

+15
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/SecretsRemoveCommand.php
+15-1Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Symfony\Bundle\FrameworkBundle\Secrets\AbstractVault;
1515
use Symfony\Component\Console\Command\Command;
16+
use Symfony\Component\Console\Completion\CompletionInput;
17+
use Symfony\Component\Console\Completion\CompletionInterface;
18+
use Symfony\Component\Console\Completion\CompletionSuggestions;
1619
use Symfony\Component\Console\Input\InputArgument;
1720
use Symfony\Component\Console\Input\InputInterface;
1821
use Symfony\Component\Console\Input\InputOption;
@@ -26,7 +29,7 @@
2629
*
2730
* @internal
2831
*/
29-
final class SecretsRemoveCommand extends Command
32+
final class SecretsRemoveCommand extends Command implements CompletionInterface
3033
{
3134
protected static $defaultName = 'secrets:remove';
3235
protected static $defaultDescription = 'Remove a secret from the vault';
@@ -80,4 +83,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8083

8184
return 0;
8285
}
86+
87+
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
88+
{
89+
if (!$input->mustSuggestArgumentValuesFor('name')) {
90+
return;
91+
}
92+
93+
$vault = $input->getOption('local') ? $this->localVault : $this->vault;
94+
$vaultKeys = array_keys($this->vault->list(false));
95+
$suggestions->suggestValues(array_intersect($vaultKeys, array_keys($vault->list(false))));
96+
}
8397
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.