From a6aa9781eb9c4e699bde8be668b88c4fef2325ff Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 9 Jan 2020 11:54:03 -0500 Subject: [PATCH] Adding better output to secrets:decrypt-to-local command --- .../Command/SecretsDecryptToLocalCommand.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php index e4fbfd287ede..6bc1ecf073f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php @@ -69,12 +69,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int $secrets = $this->vault->list(true); + $io->comment(sprintf('%d secret%s found in the vault.', \count($secrets), 1 !== \count($secrets) ? 's' : '')); + + $skipped = 0; if (!$input->getOption('force')) { foreach ($this->localVault->list() as $k => $v) { - unset($secrets[$k]); + if (isset($secrets[$k])) { + ++$skipped; + unset($secrets[$k]); + } } } + if ($skipped > 0) { + $io->warning([ + sprintf('%d secret%s already overridden in the local vault and will be skipped.', $skipped, 1 !== $skipped ? 's are' : ' is'), + 'Use the --force flag to override these.', + ]); + } + foreach ($secrets as $k => $v) { if (null === $v) { $io->error($this->vault->getLastMessage()); @@ -83,6 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $this->localVault->seal($k, $v); + $io->note($this->localVault->getLastMessage()); } return 0;