mirror of
https://github.com/minio/minio.git
synced 2025-11-24 11:37:46 -05:00
vendorize: update all vendorized packages. (#2206)
Bring in new changes from upstream for all the packages. Important ones include - gorilla/mux - logrus - jwt
This commit is contained in:
19
vendor/github.com/cheggaaa/pb/pb.go
generated
vendored
19
vendor/github.com/cheggaaa/pb/pb.go
generated
vendored
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// Current version
|
||||
const Version = "1.0.2"
|
||||
const Version = "1.0.4"
|
||||
|
||||
const (
|
||||
// Default refresh rate - 200ms
|
||||
@@ -81,6 +81,7 @@ type ProgressBar struct {
|
||||
Width int
|
||||
ForceWidth bool
|
||||
ManualUpdate bool
|
||||
AutoStat bool
|
||||
|
||||
// Default width for the time box.
|
||||
UnitsWidth int
|
||||
@@ -115,6 +116,7 @@ func (pb *ProgressBar) Start() *ProgressBar {
|
||||
if pb.Total == 0 {
|
||||
pb.ShowTimeLeft = false
|
||||
pb.ShowPercent = false
|
||||
pb.AutoStat = false
|
||||
}
|
||||
if !pb.ManualUpdate {
|
||||
pb.Update() // Initial printing of the bar before running the bar refresher.
|
||||
@@ -128,6 +130,12 @@ func (pb *ProgressBar) Increment() int {
|
||||
return pb.Add(1)
|
||||
}
|
||||
|
||||
// Get current value
|
||||
func (pb *ProgressBar) Get() int64 {
|
||||
c := atomic.LoadInt64(&pb.current)
|
||||
return c
|
||||
}
|
||||
|
||||
// Set current value
|
||||
func (pb *ProgressBar) Set(current int) *ProgressBar {
|
||||
return pb.Set64(int64(current))
|
||||
@@ -242,6 +250,7 @@ func (pb *ProgressBar) Read(p []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
// Create new proxy reader over bar
|
||||
// Takes io.Reader or io.ReadCloser
|
||||
func (pb *ProgressBar) NewProxyReader(r io.Reader) *Reader {
|
||||
return &Reader{r, pb}
|
||||
}
|
||||
@@ -398,6 +407,14 @@ func (pb *ProgressBar) Update() {
|
||||
pb.write(c)
|
||||
pb.currentValue = c
|
||||
}
|
||||
if pb.AutoStat {
|
||||
if c == 0 {
|
||||
pb.startTime = time.Now()
|
||||
pb.startValue = 0
|
||||
} else if c >= pb.Total && pb.isFinish != true {
|
||||
pb.Finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (pb *ProgressBar) String() string {
|
||||
|
||||
8
vendor/github.com/cheggaaa/pb/reader.go
generated
vendored
8
vendor/github.com/cheggaaa/pb/reader.go
generated
vendored
@@ -15,3 +15,11 @@ func (r *Reader) Read(p []byte) (n int, err error) {
|
||||
r.bar.Add(n)
|
||||
return
|
||||
}
|
||||
|
||||
// Close the reader when it implements io.Closer
|
||||
func (r *Reader) Close() (err error) {
|
||||
if closer, ok := r.Reader.(io.Closer); ok {
|
||||
return closer.Close()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user