ctongfei / progressbar

Terminal-based progress bar for Java / JVM
http://tongfei.me/progressbar/
MIT License
1.07k stars 102 forks source link

Ability to rewind/reset progress #113

Closed TIBCOeddie closed 2 years ago

TIBCOeddie commented 2 years ago

If I am looping, I might want to show progress, and upon completing (or at any point, really) I would like to continue using the same bar, but re-set to zero. There appears to be no API that accomplishes this.

ctongfei commented 2 years ago

This is not recommended since it meddles with how the progress bar estimates the time of completion (a recommended way is to start a new progress bar). But if you must, you can do

bar.stepTo(0)

to forcibly set the progress to 0.

TIBCOeddie commented 2 years ago

As you point out, stepTo(0) doesn't really reset things, thus hold this issue for the improvement. I would have a reset() that would be equivalent to creating a new one, but without a newline/new visual progress bar.

On Sat, Oct 2, 2021 at 11:12 PM Tongfei Chen @.***> wrote:

This is not recommended since it meddles with how the progress bar estimates the time of completion (a recommended way is to start a new progress bar). But if you must, you can do

bar.stepTo(0)

to forcibly set the progress to 0.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ctongfei/progressbar/issues/113#issuecomment-932854458, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKWM7BDFJNV2WZSFBG5J3W3UE7C2FANCNFSM5FEWCQPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.