laravel / prompts

Beautiful and user-friendly forms for your command-line PHP applications.
https://laravel.com/docs/prompts
MIT License
532 stars 94 forks source link

two progress bar running at the same time disables the previous one #148

Closed ibrahem-kamal closed 5 months ago

ibrahem-kamal commented 5 months ago

Laravel Prompts Version

0.1.22

Laravel Version

11.2.0

PHP Version

8.3

Operating System & Version

macOs 14.4.1

Terminal Application

warp

Description

Giving the following example . only the second progress bar shows the advance . however first progress bar state being updated in the class but not rendered causing the output in the screenshot below

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use function Laravel\Prompts\progress;

class TestProgressCommand extends Command
{
    protected $signature = 'test:progress';

    protected $description = 'testing two progress bars at the same time';

    public function handle(): void
    {
        $firstProgressBar = progress(label: 'First progress bar', steps: 5);
        $secondProgressBar = progress(label: 'Second progress bar', steps: 10);

        $firstProgressBar->start();
        $secondProgressBar->start();
        for ($i = 0; $i < 5; $i++) {
            $firstProgressBar->advance();
            for ($j = 0; $j < 10; $j++) {
                $secondProgressBar->advance();
            }
        }
        $firstProgressBar->finish();
        $secondProgressBar->finish();
    }
}
image

Steps To Reproduce

create the command provided in the issue description and test it

driesvints commented 5 months ago

I don't think we support running two at the same time?