piotrmurach / tty-progressbar

Display a single or multiple progress bars in the terminal.

Home Page:https://ttytoolkit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider start/reset

vincentjames501 opened this issue · comments

Right now the start_at time on the ProgressBar is set once the counter advances from zero. It would be nice to have more control over this as the eta and elapsed time could be wrong (the time shouldn't necessarily start when the progress advances past).

p = TTY::ProgressBar.new("[:bar]", total: 100)
p.start # Draws the bar @0% progress and initializes the start_at property
p.advance(50) # Draws the bar @50% progress
p.reset # Resets the progress bar @0% progress
p.advance(50) # Draws the bar @50% progress
p.finish # Draws the bar @100% progress and finishes it

Implemented in the master and documented.