-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: Use progress bar to display docker output #913
Conversation
Got this when trying it out:
|
hmm.. 🔍 |
Co-authored-by: Alex Plischke <alex.plischke@saucelabs.com>
// Note: The Docker API may return a current value greater than total. To prevent breaking the progress bar, | ||
// only update when the current is less than total. |
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.
Does that really break the progress bar?
This works fine for me, even when the loop goes beyond the max total of the bar.
func main() {
bar := progressbar.Default(50)
for i := 0; i < 100; i++ {
_ = bar.Add(1)
time.Sleep(40 * time.Millisecond)
}
}
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.
I'm not using Add
. Set64
can break it.
func main() {
bar := progressbar.Default(50)
bar.Set64(3000)
err := bar.Finish()
fmt.Println("err: ", err)
}
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.
https://github.com/schollz/progressbar/blob/v3.14.3/progressbar.go#L551C1-L557C3
The added number is not checked. So current number is greater than total after this piece of code.
Add
can also break it.
func main() {
bar := progressbar.Default(50)
bar.Add(51)
err := bar.Finish()
fmt.Println("err: ", err)
}
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.
😄 100% break
func main() {
bar := progressbar.Default(50)
for i := 0; i < 100; i++ {
err := bar.Add(3)
if err != nil {
fmt.Println("err: ", err)
break
}
time.Sleep(40 * time.Millisecond)
}
}
Description
Use progress spinner to display docker output.
The output from the Docker API consists of groups of steps, each group having an identical ID and logging in parallel.
Use a spinner to display steps without detailed progress and a progress bar to show the progress of the pushing status.
Output: