From 788ef76f1cfa0e7965d6004b1c5f1a373dba3a4f Mon Sep 17 00:00:00 2001 From: klauspost Date: Thu, 17 Sep 2015 15:53:45 +0200 Subject: [PATCH] Show more of the filename and align output. Print more of the file name, and make the output aligned, so it is nicer on frequent updates. --- fs/accounting.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/accounting.go b/fs/accounting.go index fb08f6d99..95522897a 100644 --- a/fs/accounting.go +++ b/fs/accounting.go @@ -396,13 +396,14 @@ func (file *Account) String() string { } } name := []rune(file.name) - if len(name) > 25 { - name = name[:25] + if len(name) > 45 { + where := len(name) - 42 + name = append([]rune{'.','.','.'}, name[where:]...) } if b <= 0 { - return fmt.Sprintf("%s: avg:%7.1f, cur: %6.1f kByte/s. ETA: %s", string(name), avg/1024, cur/1024, etas) + return fmt.Sprintf("%45s: avg:%7.1f, cur: %6.1f kByte/s. ETA: %s", string(name), avg/1024, cur/1024, etas) } - return fmt.Sprintf("%s: %2d%% done. avg: %6.1f, cur: %6.1f kByte/s. ETA: %s", string(name), int(100*float64(a)/float64(b)), avg/1024, cur/1024, etas) + return fmt.Sprintf("%45s: %2d%% done. avg: %6.1f, cur: %6.1f kByte/s. ETA: %s", string(name), int(100*float64(a)/float64(b)), avg/1024, cur/1024, etas) } // Close the object