From 61779502fba12b02129f51a55a430d86c7ea087e Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Thu, 23 Apr 2015 01:46:05 -0700 Subject: [PATCH] Humanize ls size field --- .../_workspace/src/github.com/dustin/go-humanize/comma.go | 4 ++-- cmd-ls.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/comma.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/comma.go index 80dbfa78..9d0d2ed1 100644 --- a/Godeps/_workspace/src/github.com/dustin/go-humanize/comma.go +++ b/Godeps/_workspace/src/github.com/dustin/go-humanize/comma.go @@ -33,7 +33,7 @@ func Comma(v int64) string { j-- } parts[j] = strconv.Itoa(int(v)) - return sign + strings.Join(parts[j:], ",") + return sign + strings.Join(parts[j:len(parts)], ",") } // Commaf produces a string form of the given number in base 10 with @@ -97,5 +97,5 @@ func BigComma(b *big.Int) string { j-- } parts[j] = strconv.Itoa(int(b.Int64())) - return sign + strings.Join(parts[j:], ",") + return sign + strings.Join(parts[j:len(parts)], ",") } diff --git a/cmd-ls.go b/cmd-ls.go index bf9f5047..8233a229 100644 --- a/cmd-ls.go +++ b/cmd-ls.go @@ -21,7 +21,7 @@ import ( "fmt" - "github.com/cheggaaa/pb" + "github.com/dustin/go-humanize" "github.com/minio-io/cli" "github.com/minio-io/mc/pkg/client" "github.com/minio-io/mc/pkg/console" @@ -45,8 +45,8 @@ func printItems(v []*client.Item) { // printItem prints item meta-data func printItem(date time.Time, v int64, name string) { - fmt.Printf(console.Time("%s ", date.Local().Format(printDate))) - fmt.Printf(console.Size("[%9s] ", pb.FormatBytes(v))) + fmt.Printf(console.Time("[%s] ", date.Local().Format(printDate))) + fmt.Printf(console.Size("%5s ", humanize.Bytes(uint64(v)))) fmt.Println(console.File("%s", name)) }