schollz / progressbar

A really basic thread-safe progress bar for Golang applications
https://pkg.go.dev/github.com/schollz/progressbar/v3?tab=doc
MIT License
4.08k stars 220 forks source link

progressbar.OptionSetItsString don't work #171

Closed inuyasha-660 closed 8 months ago

inuyasha-660 commented 8 months ago

English is not my native language , please forgive my grammatical errors.

I try use progressbar.OptionSetItsString("Mbp"), to set the what's displayed for iterations a second , but when i run it in terminal ,i can't see the Mbp/s , even i can't see the default "it/s" . I think maybe some problems in setting up , this is my config , can you help me take a look.

bar := progressbar.NewOptions(100,
    progressbar.OptionEnableColorCodes(true),
    progressbar.OptionSetItsString("Mbp"),
    progressbar.OptionSetDescription("|"),
    progressbar.OptionFullWidth(),
    progressbar.OptionSetTheme(progressbar.Theme{
        Saucer:        "[green]=[reset]",
        SaucerHead:    "[green]>[reset]",
        SaucerPadding: " ",
        BarStart:      "[",
        BarEnd:        "]",
    }))
for i := 0; i < 100; i++ {
            bar.Add(1)
            time.Sleep(50 * time.Millisecond)
    }
inuyasha-660 commented 8 months ago

luckly , i find out the Answer in https://github.com/schollz/progressbar/blob/main/progressbar_test.go , i need to add
progressbar.OptionShowIts(), in my config to show the its