tty-progressbar
tty-progressbar copied to clipboard
Disable auto-finish
Describe the problem
So I was hoping to use this gem to show the current status of a buffer in progress bar form. I know the maximum size, so this isn't indeterminate.
My problem? If the buffer gets full, the bar finishes, and there's no way to stop it.
I thought of just adding one to total or something, but that would throw the percentage and bar progress off.
How would the new feature work?
I was thinking an auto_finish: false option, which is checked when currently the bar ends if current == total.
Drawbacks
Can you see any potential drawbacks?
Would need to handle cases where current is set to something > total, but that wouldn't be hard.
Hi Mike,
In short, I like your idea. A flag that toggles this behaviour seems most appropriate. I wonder if manual_finish: true would be a better choice to indicate intent. Alternatively, similar to the :clear we could opt for an even shorter option finish: false. Any thoughts?
As for current going over the total value. I'm not sure we would need to worry about it. Once you indicate that you wish to control when the bar finishes it's on you to finish it whenever. You have access to the current value and you know the total. The bar stops progressing visually beyond the allowed size but the various stats will continue. Am I missing something here?