Codebase list golang-github-vbauerster-mpb / 31de581
more weight url, eta and speed decorators Vladimir Bauer 8 years ago
1 changed file(s) with 6 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
1212 )
1313
1414 func main() {
15 url := "https://github.com/onivim/oni/releases/download/v0.3.4/Oni-0.3.4-osx.dmg"
15 url := "https://github.com/onivim/oni/releases/download/v0.3.4/Oni-0.3.4-amd64-linux.deb"
1616
1717 resp, err := http.Get(url)
1818 if err != nil {
3636 }
3737 defer dest.Close()
3838
39 p := mpb.New(mpb.WithWidth(64))
39 p := mpb.New(mpb.WithWidth(60), mpb.WithRefreshRate(180*time.Millisecond))
4040
4141 sbEta := make(chan time.Time)
4242 sbSpeed := make(chan time.Time)
4545 decor.CountersKibiByte("% 6.1f / % 6.1f", decor.WC{W: 18}),
4646 ),
4747 mpb.AppendDecorators(
48 decor.ETA(decor.ET_STYLE_HHMMSS, 120, sbEta),
49 decor.SpeedKibiByte("% .2f", 120, sbSpeed, decor.WC{W: 14}),
48 decor.Name("["),
49 decor.ETA(decor.ET_STYLE_MMSS, 60, sbEta),
50 decor.Name("] "),
51 decor.SpeedKibiByte("% .2f", 60, sbSpeed),
5052 ),
5153 )
5254