diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 63b77c64..a3eff5b7 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -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" diff --git a/Godeps/_workspace/src/github.com/minio/pb/.travis.yml b/Godeps/_workspace/src/github.com/minio/pb/.travis.yml new file mode 100644 index 00000000..6e3b6fc0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/pb/.travis.yml @@ -0,0 +1,4 @@ +language: go +go: +- 1.4.2 +sudo: false diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/LICENSE b/Godeps/_workspace/src/github.com/minio/pb/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/LICENSE rename to Godeps/_workspace/src/github.com/minio/pb/LICENSE diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/README.md b/Godeps/_workspace/src/github.com/minio/pb/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/README.md rename to Godeps/_workspace/src/github.com/minio/pb/README.md diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/example/copy/copy.go b/Godeps/_workspace/src/github.com/minio/pb/example/copy/copy.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/example/copy/copy.go rename to Godeps/_workspace/src/github.com/minio/pb/example/copy/copy.go diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/example/pb.go b/Godeps/_workspace/src/github.com/minio/pb/example/pb.go similarity index 94% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/example/pb.go rename to Godeps/_workspace/src/github.com/minio/pb/example/pb.go index 140ba039..57a3fe4b 100644 --- a/Godeps/_workspace/src/github.com/cheggaaa/pb/example/pb.go +++ b/Godeps/_workspace/src/github.com/minio/pb/example/pb.go @@ -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 diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/format.go b/Godeps/_workspace/src/github.com/minio/pb/format.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/format.go rename to Godeps/_workspace/src/github.com/minio/pb/format.go diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/format_test.go b/Godeps/_workspace/src/github.com/minio/pb/format_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/format_test.go rename to Godeps/_workspace/src/github.com/minio/pb/format_test.go diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/pb.go b/Godeps/_workspace/src/github.com/minio/pb/pb.go similarity index 96% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/pb.go rename to Godeps/_workspace/src/github.com/minio/pb/pb.go index 55e00527..4e73b372 100644 --- a/Godeps/_workspace/src/github.com/cheggaaa/pb/pb.go +++ b/Godeps/_workspace/src/github.com/minio/pb/pb.go @@ -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! diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/pb_nix.go b/Godeps/_workspace/src/github.com/minio/pb/pb_nix.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/pb_nix.go rename to Godeps/_workspace/src/github.com/minio/pb/pb_nix.go diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/pb_solaris.go b/Godeps/_workspace/src/github.com/minio/pb/pb_solaris.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/pb_solaris.go rename to Godeps/_workspace/src/github.com/minio/pb/pb_solaris.go diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/pb_test.go b/Godeps/_workspace/src/github.com/minio/pb/pb_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/pb_test.go rename to Godeps/_workspace/src/github.com/minio/pb/pb_test.go diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/pb_win.go b/Godeps/_workspace/src/github.com/minio/pb/pb_win.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/pb_win.go rename to Godeps/_workspace/src/github.com/minio/pb/pb_win.go diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/pb_x.go b/Godeps/_workspace/src/github.com/minio/pb/pb_x.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/pb_x.go rename to Godeps/_workspace/src/github.com/minio/pb/pb_x.go diff --git a/Godeps/_workspace/src/github.com/cheggaaa/pb/reader.go b/Godeps/_workspace/src/github.com/minio/pb/reader.go similarity index 100% rename from Godeps/_workspace/src/github.com/cheggaaa/pb/reader.go rename to Godeps/_workspace/src/github.com/minio/pb/reader.go diff --git a/main.go b/main.go index ad3133a8..d38fc33d 100644 --- a/main.go +++ b/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. diff --git a/pb.go b/pb.go index 352b589b..5fa1940c 100644 --- a/pb.go +++ b/pb.go @@ -24,8 +24,8 @@ import ( "sync/atomic" "time" - "github.com/cheggaaa/pb" "github.com/minio/mc/pkg/console" + "github.com/minio/pb" ) type pbBarCmd int