-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnew.go
61 lines (53 loc) · 1.38 KB
/
new.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package progressbar
import "time"
func Add(maxBytes int64, title string, opts ...Opt) MultiPB {
defaultMPB.Add(maxBytes, title, opts...)
return defaultMPB
}
var defaultMPB = multiBar2()
// New creates a managed MultiPB progressbar object so you
// can setup the properties of the bar.
//
// bar := progressbar.New()
// bar.Add(
// resp.ContentLength,
// "downloading go1.14.2.src.tar.gz",
// // progressbar.WithSpinner(14),
// // progressbar.WithStepper(3),
// progressbar.WithBarStepper(0),
// )
//
// A MultiPB or PB progressbar object is a writable object
// which can receive the data writing via Writer interface:
//
// f, _ := os.OpenFile("debug.log", os.O_CREATE|os.O_WRONLY, 0o644)
// _, _ = io.Copy(io.MultiWriter(f, bar), resp.Body)
// f.Close()
// bar.Close()
//
// The MultiPB object can be added into Tasks container. For
// more information to see NewTasks() and NewDownloadTasks().
func New(opts ...MOpt) MultiPB {
bar := multiBar2(opts...)
return bar
}
// NewGPB creates a grouped MultiPB (GroupedPB) instance.
func NewGPB(opts ...MOpt) GroupedPB {
bar := multiBar2(opts...)
return bar
}
type SchemaData struct {
Data any // your customized data structure here
Indent string
Prepend string
Bar string
Percent string
Title string
Current string
Total string
Elapsed string
Speed string
Append string
PercentFloat float64
ElapsedTime time.Duration
}