Split progressbar output into two windows.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-08-31 13:15:06 +00:00
parent 37049ba6f4
commit 7ab7998ac7
3 changed files with 40 additions and 27 deletions

View File

@ -9,6 +9,7 @@ use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use App\Template\Twig;
use App\Notification\Notification;
@ -45,6 +46,13 @@ class CommandBackup extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
$sio = new SymfonyStyle($input, $output);
$sioProgressbar = &$sio;
if ($output instanceof ConsoleOutputInterface) {
$sio = new SymfonyStyle($input, $output->section());
$sioProgressbar = new SymfonyStyle($input, $output->section());
}
$sio->title('Start backup process');
try {
@ -68,7 +76,7 @@ class CommandBackup extends Command
/** @var array{title: string, source: string, destination: string}[] */
$backupElements = $app->getConfig('backup');
/** @var array{title: string, source: string, destination: string} $conf */
foreach ($sio->progressIterate($backupElements) as $conf) {
foreach ($sioProgressbar->progressIterate($backupElements) as $conf) {
$title = $conf['title'];
$template = array();
$template['config'] = $conf;