Adding better output to secrets:decrypt-to-local command

This commit is contained in:
Ryan Weaver 2020-01-09 11:54:03 -05:00
parent 5c37ab016c
commit a6aa9781eb

View File

@ -69,12 +69,25 @@ EOF
$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 @@ EOF
}
$this->localVault->seal($k, $v);
$io->note($this->localVault->getLastMessage());
}
return 0;