-
Notifications
You must be signed in to change notification settings - Fork 17
ProgressBar interface #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@jzelinskie can't we just use the progress bar from rkt? cc @jonboulle |
@philips does that handle drawing multiple bars on the screen at once? I didn't think it did. |
@dgonyeo is working on that right now, looping him in On Wed, Apr 20, 2016 at 6:22 PM, Jimmy Zelinskie notifications@github.com
|
That's cool, either way I think the code can be much cleaner if we use an interface to minimize the ProgressBar logic that leaks into other functions. |
My redesign right now is actually aiming to do that, since (as I'm sure you've noticed) using ioprogress in its current state requires the user to write a good amount of logic. The current API (feedback would be appreciated!):
Example usage would be something like this:
|
Our usage actually isn't based around Readers; has that been taken into consideration as well? |
Not at all, right now it's geared for just docker2acis use case. Would you just want to manually update the progress bars?
|
Yeah, we manually update our progress bars: https://github.com/coreos/quayctl/blob/a75bf650cd08f91c036b92c92e6060c6d8be96e2/engine/torrent.go#L75-L160 |
I can probably split out the progress bar logic and have the io.Reader copy logic just use that. I'll keep you posted. |
@jzelinskie Would this work for you giuys? coreos/ioprogress#7 |
@dgonyeo I think all we need to be able to specify prefixes and suffixes for each progress bar, set the total and the current state, and the frequency of redraws. |
The If a wrapper around |
That wrapper would be perfect for our use case. |
I'll implement that in a followup PR.
|
In order to encapsulate the logic around ProgressBars, we should have a ProgressBar interface.
For example, in the main package we could detect the interactivity of the shell once and use a no-op ProgressBar implementation to avoid that logic bleeding throughout the program. A real implementation of this interface would also cover the default behaviors like setting the
MaxWidth
and what completed lines look like, etc...The text was updated successfully, but these errors were encountered: