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
Add progress bars to long-running operations #153
Conversation
Wrap oras.Target in a struct that shows progress bars for the Push operation. The wrap function can be used on any target to show a progress bar when we push data to it (note, the oras Copy operation uses the Pusher interface internally) This adds a new dependency to go.mod, for github.com/vbauerster/mpb/v8. The mpb package automatically suppresses logging progress bars when output is not a TTY.
Add progress bar for unpacking. For this case, as kit potentially prints info lines while unpacking, logs are printed above a progress bar, and the progress bar is removed on completion to avoid cluttering the display.
Rework progress bar wrappers to return an output struct that should be used instead of the default output functions. This allows printing information above a progress bar without the bar overwriting output.
Probably needs a test update |
Yup, I missed a couple edge cases in porting the tests over to the output package. I dropped the padding on byte quantities since I think it's no longer necessary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM...
Feels like ProgressLogger
may need another iteration for easier usage but I could not really imagine how we would simplfy it yet.
Yeah, agreed. I'm not thrilled with it. |
Add progress bars for kit push, pull, and unpack:
Unpack
Pull (Push is the same)
Progress bars can be disabled via
--progress=false
and are disabled when the output is not a TTY. For push/pull, one progress bar is shown per blob downloaded; for unpack a progress bar is shown for the current step, below the regular output, which allows for regular logging (e.g. debug logs) without interfering with the bar.