Git Product home page Git Product logo

php-cli-progress-bar's People

Contributors

fracz avatar guiguiboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-cli-progress-bar's Issues

Clarification sur la licence d'utilisation

Il faudrait clarifier la licence sous laquelle est distribué la librairie (dans le composer.json et/ou le README.md).
En l'état actuel des choses, je ne sais pas si je peux l'utiliser dans une application sous licence GPL.

Release number?

Hey guys,

Thanks for the awesome work. Is there the possibility of fixing a stable version?

Thanks,

Create increment method

For each progress bar I need to track the loop counter in order to update it.

$loop = 0;
$progress = new \ProgressBar\Manager(0, count($array));
foreach($array as $element){
    // do something with $element
    $progress->update(++$loop);
}

Wouldn't it be better to have an increment() or advance() method to do this operation?

$progress = new \ProgressBar\Manager(0, count($array));
foreach($array as $element){
    // do something with $element
    $progress->advance();
}

Performance : Execution Time.

Hello,

To help the author with this todo ("ask developpers for feedback"). Use this class carefully because it can increase (a lot) the execution time in a very big loop !

Use a modulo to not update every iteration.

Ajout d'un tag

Ajouter un tag permettrait de cibler plus précisément la version voulue dans notre composer.json (au lieu de cibler en dur le hash du dernier commit)

Batch importing, progress bar ETA is off

Hi, great library!

I'm using it in an API context where the destination environment is requesting data from API in batches of 200 data pieces. The problem is after the first batch of 200 is processed, the next batch is requested and either the ETA is really high and decreases or it starts from 0 and increases towards the initial ETA of the first batch, depending on:

  • if I set the initial starting point to 0 or current count,
  • if I use update(currentStep) or advance().

Can you please help in this regard? Am I missing something from the library that I haven't used?

Enhancement for displaying custom messages

We should be able to set a custom message somewhere,

like downloading file1 when it finishes, we say downloading file2 or executing 1/20 queries, executing 2/20 queries etc

update() only accepts integers

update() only accepts integers while outputting progress bar uses number_format($percent,2) which gives it two decimal places.

License

What license is this under? BSD, MIT?

Please make a release

Please make a release of your library for not to add dev-master as version constraint to composer.json dependency.

Notice if start current isn't 0

If I init the progress bar with a number higher than 0, e.g.

$progressBar = new \ProgressBar\Manager(1, 10);

php throws a notice because in Manager.php Line 109 there is an access to key 0

$initialTime           = $advancement[0];

How to add an elapsed time field

$pb = new ProgressBar();
addEtaToProgressBar($pb);
$pb->setFormat('%current%/%max% %elapsed% [%bar%] %percent%% %eta%');

function addEtaToProgressBar(ProgressBar &$progressBar)
{
    $registry = $progressBar->getRegistry();

    $registry->setValue('startTime', time());

    $progressBar->addReplacementRule(
        '%elapsed%',
        40,
        function ($buffer, $registry) {
            /** @var \ProgressBar\Registry $registry */
            $elapsed = time() - $registry->getValue('startTime');

            $hoursCount            = intval($elapsed / 3600);
            $rest                  = ($elapsed % 3600);
            $minutesCount          = intval($rest / 60);
            $secondsCount          = ($rest % 60);

            return sprintf("%02d:%02d:%02d", $hoursCount, $minutesCount, $secondsCount);
        }
    );
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.