Skip to content

Commit

Permalink
stats: condensed transfer output to fit 80x25 terminals
Browse files Browse the repository at this point in the history
  • Loading branch information
ishuah committed Dec 9, 2017
1 parent 5061aaa commit b05e472
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions fs/accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ func (acc *Account) ETA() (eta time.Duration, ok bool) {
// String produces stats for this file
func (acc *Account) String() string {
a, b := acc.Progress()
bps, cur := acc.Speed()
_, cur := acc.Speed()
eta, etaok := acc.ETA()
etas := "-"
if etaok {
Expand All @@ -572,26 +572,26 @@ func (acc *Account) String() string {
}
}
name := []rune(acc.name)
if len(name) > 45 {
where := len(name) - 42
if len(name) > 40 {
where := len(name) - 37
name = append([]rune{'.', '.', '.'}, name[where:]...)
}

if Config.DataRateUnit == "bits" {
cur = cur * 8
}

done := fmt.Sprintf("%2s/%s", SizeSuffix(a), SizeSuffix(b))
percentageDone := 0
if b > 0 {
done += fmt.Sprintf(" %2d%% done, ", int(100*float64(a)/float64(b)))
} else {
done += " 0%% done, "
percentageDone = int(100 * float64(a) / float64(b))
}
return fmt.Sprintf("%45s: %s%s / %s, ETA: %s",

done := fmt.Sprintf("%2d%% /%s", percentageDone, SizeSuffix(b))

return fmt.Sprintf("%45s: %s, %s/s, %s",
string(name),
done,
SizeSuffix(bps).Unit(strings.Title(Config.DataRateUnit)+"/s"),
SizeSuffix(cur).Unit(strings.Title(Config.DataRateUnit)+"/s"),
SizeSuffix(cur),
etas,
)
}
Expand Down

0 comments on commit b05e472

Please sign in to comment.