progressbar
progressbar copied to clipboard
How to display all steps in spinner
I'm trying this code:
func main() {
bar := progressbar.NewOptions(-1,
progressbar.OptionSetDescription("spinnertest"),
progressbar.OptionShowIts(),
progressbar.OptionShowCount(),
progressbar.OptionSpinnerType(7),
)
for i:=0; i < 100; i++ {
bar.Add(1)
time.Sleep(1 * time.Second)
}
}
And I'm expecting that each time it updates, it would move 1 step in the spinner, instead it just flops back and forth between 2 values. If I use spinners with more steps, 1 second intervals also seem to skip steps.
If I change the delay to be time.Sleep(500 * time.Millisecond)
it does work and I see all 4 steps, but my proposed usage would be at 1 second intervals. On the other hand, if I go to time.Sleep(2 * time.Second)
I get no change in the spinner, although in all situations the count increments correctly.
Is there somewhere I need to set the "total time lapse" of a spinner rotation?
would accept PR