mirror of
https://github.com/minio/mc.git
synced 2025-11-12 01:02:26 +03:00
Going to use minio/pb forked version as primary, since we might make more changes in future.
While we submit all our changes upstream
This commit is contained in:
8
Godeps/Godeps.json
generated
8
Godeps/Godeps.json
generated
@@ -5,10 +5,6 @@
|
||||
"./..."
|
||||
],
|
||||
"Deps": [
|
||||
{
|
||||
"ImportPath": "github.com/cheggaaa/pb",
|
||||
"Rev": "e648e12b78cedf14ebb2fc1855033f07b034cfbb"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/dustin/go-humanize",
|
||||
"Rev": "8cc1aaa2d955ee82833337cfb10babc42be6bce6"
|
||||
@@ -40,6 +36,10 @@
|
||||
"Comment": "release-1434511043-18-g792e6c2",
|
||||
"Rev": "792e6c2d3a0bee392abd049e70f0cad52a5f8320"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/minio/pb",
|
||||
"Rev": "48437da7a8df656ce8a124f49c97dc88421cf528"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/olekukonko/ts",
|
||||
"Rev": "ecf753e7c962639ab5a1fb46f7da627d4c0a04b8"
|
||||
|
||||
4
Godeps/_workspace/src/github.com/minio/pb/.travis.yml
generated
vendored
Normal file
4
Godeps/_workspace/src/github.com/minio/pb/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.4.2
|
||||
sudo: false
|
||||
@@ -13,7 +13,7 @@ func main() {
|
||||
bar.ShowPercent = true
|
||||
|
||||
// show bar (by default already true)
|
||||
bar.ShowPercent = true
|
||||
bar.ShowBar = true
|
||||
|
||||
// no need counters
|
||||
bar.ShowCounters = true
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -267,9 +268,10 @@ func (pb *ProgressBar) write(current int64) {
|
||||
speedBox = Format(int64(speed), pb.Units) + "/s "
|
||||
}
|
||||
|
||||
barWidth := utf8.RuneCountInString(countersBox + pb.BarStart + pb.BarEnd + percentBox + timeLeftBox + speedBox + pb.prefix + pb.postfix)
|
||||
// bar
|
||||
if pb.ShowBar {
|
||||
size := width - len(countersBox+pb.BarStart+pb.BarEnd+percentBox+timeLeftBox+speedBox+pb.prefix+pb.postfix)
|
||||
size := width - barWidth
|
||||
if size > 0 {
|
||||
if pb.Total > 0 {
|
||||
curCount := int(math.Ceil((float64(current) / float64(pb.Total)) * float64(size)))
|
||||
@@ -306,8 +308,8 @@ func (pb *ProgressBar) write(current int64) {
|
||||
|
||||
// check len
|
||||
out = pb.prefix + countersBox + barBox + percentBox + speedBox + timeLeftBox + pb.postfix
|
||||
if len(out) < width {
|
||||
end = strings.Repeat(" ", width-len(out))
|
||||
if utf8.RuneCountInString(out) < width {
|
||||
end = strings.Repeat(" ", width-utf8.RuneCountInString(out))
|
||||
}
|
||||
|
||||
// and print!
|
||||
2
main.go
2
main.go
@@ -23,10 +23,10 @@ import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
|
||||
"github.com/cheggaaa/pb"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/minio/minio/pkg/iodine"
|
||||
"github.com/minio/pb"
|
||||
)
|
||||
|
||||
// Check for the environment early on and gracefully report.
|
||||
|
||||
Reference in New Issue
Block a user