1
0
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:
Harshavardhana
2015-07-04 19:44:43 -07:00
parent 072106ec30
commit 12680b6fbf
17 changed files with 16 additions and 10 deletions

8
Godeps/Godeps.json generated
View File

@@ -5,10 +5,6 @@
"./..." "./..."
], ],
"Deps": [ "Deps": [
{
"ImportPath": "github.com/cheggaaa/pb",
"Rev": "e648e12b78cedf14ebb2fc1855033f07b034cfbb"
},
{ {
"ImportPath": "github.com/dustin/go-humanize", "ImportPath": "github.com/dustin/go-humanize",
"Rev": "8cc1aaa2d955ee82833337cfb10babc42be6bce6" "Rev": "8cc1aaa2d955ee82833337cfb10babc42be6bce6"
@@ -40,6 +36,10 @@
"Comment": "release-1434511043-18-g792e6c2", "Comment": "release-1434511043-18-g792e6c2",
"Rev": "792e6c2d3a0bee392abd049e70f0cad52a5f8320" "Rev": "792e6c2d3a0bee392abd049e70f0cad52a5f8320"
}, },
{
"ImportPath": "github.com/minio/pb",
"Rev": "48437da7a8df656ce8a124f49c97dc88421cf528"
},
{ {
"ImportPath": "github.com/olekukonko/ts", "ImportPath": "github.com/olekukonko/ts",
"Rev": "ecf753e7c962639ab5a1fb46f7da627d4c0a04b8" "Rev": "ecf753e7c962639ab5a1fb46f7da627d4c0a04b8"

View File

@@ -0,0 +1,4 @@
language: go
go:
- 1.4.2
sudo: false

View File

@@ -13,7 +13,7 @@ func main() {
bar.ShowPercent = true bar.ShowPercent = true
// show bar (by default already true) // show bar (by default already true)
bar.ShowPercent = true bar.ShowBar = true
// no need counters // no need counters
bar.ShowCounters = true bar.ShowCounters = true

View File

@@ -8,6 +8,7 @@ import (
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
"unicode/utf8"
) )
const ( const (
@@ -267,9 +268,10 @@ func (pb *ProgressBar) write(current int64) {
speedBox = Format(int64(speed), pb.Units) + "/s " speedBox = Format(int64(speed), pb.Units) + "/s "
} }
barWidth := utf8.RuneCountInString(countersBox + pb.BarStart + pb.BarEnd + percentBox + timeLeftBox + speedBox + pb.prefix + pb.postfix)
// bar // bar
if pb.ShowBar { 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 size > 0 {
if pb.Total > 0 { if pb.Total > 0 {
curCount := int(math.Ceil((float64(current) / float64(pb.Total)) * float64(size))) curCount := int(math.Ceil((float64(current) / float64(pb.Total)) * float64(size)))
@@ -306,8 +308,8 @@ func (pb *ProgressBar) write(current int64) {
// check len // check len
out = pb.prefix + countersBox + barBox + percentBox + speedBox + timeLeftBox + pb.postfix out = pb.prefix + countersBox + barBox + percentBox + speedBox + timeLeftBox + pb.postfix
if len(out) < width { if utf8.RuneCountInString(out) < width {
end = strings.Repeat(" ", width-len(out)) end = strings.Repeat(" ", width-utf8.RuneCountInString(out))
} }
// and print! // and print!

View File

@@ -23,10 +23,10 @@ import (
"runtime" "runtime"
"strconv" "strconv"
"github.com/cheggaaa/pb"
"github.com/minio/cli" "github.com/minio/cli"
"github.com/minio/mc/pkg/console" "github.com/minio/mc/pkg/console"
"github.com/minio/minio/pkg/iodine" "github.com/minio/minio/pkg/iodine"
"github.com/minio/pb"
) )
// Check for the environment early on and gracefully report. // Check for the environment early on and gracefully report.

2
pb.go
View File

@@ -24,8 +24,8 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/cheggaaa/pb"
"github.com/minio/mc/pkg/console" "github.com/minio/mc/pkg/console"
"github.com/minio/pb"
) )
type pbBarCmd int type pbBarCmd int