Skip to content

Commit a6aa978

Browse files
committed
Adding better output to secrets:decrypt-to-local command
1 parent 5c37ab0 commit a6aa978

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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

+15-1
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6969

7070
$secrets = $this->vault->list(true);
7171

72+
$io->comment(sprintf('%d secret%s found in the vault.', \count($secrets), 1 !== \count($secrets) ? 's' : ''));
73+
74+
$skipped = 0;
7275
if (!$input->getOption('force')) {
7376
foreach ($this->localVault->list() as $k => $v) {
74-
unset($secrets[$k]);
77+
if (isset($secrets[$k])) {
78+
++$skipped;
79+
unset($secrets[$k]);
80+
}
7581
}
7682
}
7783

84+
if ($skipped > 0) {
85+
$io->warning([
86+
sprintf('%d secret%s already overridden in the local vault and will be skipped.', $skipped, 1 !== $skipped ? 's are' : ' is'),
87+
'Use the --force flag to override these.',
88+
]);
89+
}
90+
7891
foreach ($secrets as $k => $v) {
7992
if (null === $v) {
8093
$io->error($this->vault->getLastMessage());
@@ -83,6 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8396
}
8497

8598
$this->localVault->seal($k, $v);
99+
$io->note($this->localVault->getLastMessage());
86100
}
87101

88102
return 0;

0 commit comments

Comments
 (0)