Skip to content

Commit

Permalink
Merge pull request #9752 from afbjorklund/download-ellipsis
Browse files Browse the repository at this point in the history
Abbreviate too long filenames to show progress
  • Loading branch information
medyagh authored Nov 20, 2020
2 parents be85445 + d6f14d6 commit 61abd1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/minikube/download/progressbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ func (cpb *progressBar) TrackProgress(src string, currentSize, totalSize int64,
cpb.progress = pb.New64(totalSize)
}
p := pb.Full.Start64(totalSize)
p.Set("prefix", " > "+filepath.Base(src+": "))
fn := filepath.Base(src)
// abbreviate filename for progress
maxwidth := 30 - len("...")
if len(fn) > maxwidth {
fn = fn[0:maxwidth] + "..."
}
p.Set("prefix", " > "+fn+": ")
p.SetCurrent(currentSize)
p.Set(pb.Bytes, true)

Expand Down

0 comments on commit 61abd1e

Please sign in to comment.