Skip to content

Commit

Permalink
Show more of the filename and align output.
Browse files Browse the repository at this point in the history
Print more of the file name, and make the output aligned, so it is nicer on frequent updates.
  • Loading branch information
klauspost committed Sep 17, 2015
1 parent 0872ec3 commit 788ef76
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 788ef76

Please sign in to comment.