2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

cmd/restic: Remove trailing "..." from progress messages

These were added after message since the last refactor of the progress
printing code. Also skips an allocation in the common case.
This commit is contained in:
greatroar 2022-05-31 18:41:46 +02:00
parent 74f7fe2b98
commit b7c990871f

View File

@ -58,7 +58,10 @@ func printProgress(status string, canUpdateStatus bool) {
if w < 3 {
status = termstatus.Truncate(status, w)
} else {
status = termstatus.Truncate(status, w-3) + "..."
trunc := termstatus.Truncate(status, w-3)
if len(trunc) < len(status) {
status = trunc + "..."
}
}
}