Repository: ollama/ollama
File: progress/bar.go (Go)

Code before:
		suf.WriteString(strings.Repeat(" ", 6-len(curValue)))
		suf.WriteString(curValue)
		suf.WriteString("/")

		maxValue := format.HumanBytes(b.maxValue)
		suf.WriteString(strings.Repeat(" ", 6-len(maxValue)))
		suf.WriteString(maxValue)
	} else {
		maxValue := format.HumanBytes(b.maxValue)
		suf.WriteString(strings.Repeat(" ", 6-len(maxValue)))
		suf.WriteString(maxValue)
		suf.WriteString(strings.Repeat(" ", 7))
	}

	rate := b.rate()
	// max 10 characters: ", 999 MB/s"
	if b.stopped.IsZero() {
		suf.WriteString(", ")
		humanRate := format.HumanBytes(int64(rate))
		suf.WriteString(strings.Repeat(" ", 6-len(humanRate)))
		suf.WriteString(humanRate)
		suf.WriteString("/s")
	} else {
		suf.WriteString(strings.Repeat(" ", 10))
	}

	// max 8 characters: ", 59m59s"
	if b.stopped.IsZero() {
		suf.WriteString(", ")
		var remaining time.Duration
		if rate > 0 {
			remaining = time.Duration(int64(float64(b.maxValue-b.currentValue)/rate)) * time.Second
		}

		humanRemaining := formatDuration(remaining)
		suf.WriteString(strings.Repeat(" ", 6-len(humanRemaining)))
		suf.WriteString(humanRemaining)
	} else {
		suf.WriteString(strings.Repeat(" ", 8))
	}

	var mid strings.Builder
	// add 3 extra spaces: 2 boundary characters and 1 space at the end
	f := termWidth - pre.Len() - suf.Len() - 3
	n := int(float64(f) * b.percent() / 100)

	mid.WriteString("▕")

	if n > 0 {
		mid.WriteString(strings.Repeat("█", n))
	}

Review comment (bug):
I seem to be getting an error here:
```
pulling manifest 
panic: strings: negative Repeat count

goroutine 38 [running]:
strings.Repeat({0x101195a58?, 0x140004de8c0?}, 0x100d66557?)
	/opt/homebrew/Cellar/go/1.21.3/libexec/src/strings/strings.go:554 +0x2e0
github.com/jmorganca/ollama/progress.(*Bar).String(0x140000ac080)
	/Users/jmorgan/workspace/ollama/progress/bar.go:103 +0xa1c
github.com/jmorganca/ollama/progress.(*Progress).render(0x140004fe6c0)
	/Users/jmorgan/workspace/ollama/progress/progress.go:97 +0x228
github.com/jmorganca/ollama/progress.(*Progress).start(0x140004fe6c0)
	/Users/jmorgan/workspace/ollama/progress/progress.go:111 +0x74
created by github.com/jmorganca/ollama/progress.NewProgress in goroutine 1
	/Users/jmorgan/workspace/ollama/progress/progress.go:26 +0xa0
```

I'm guessing `humanRate` is >6 characters?

Code after:
	fmt.Fprintf(&pre, "%3.0f%%", b.percent())

	var suf strings.Builder
	// max 13 characters: "999 MB/999 MB"
	if b.stopped.IsZero() {
		curValue := format.HumanBytes(b.currentValue)
		suf.WriteString(repeat(" ", 6-len(curValue)))
		suf.WriteString(curValue)
		suf.WriteString("/")

		maxValue := format.HumanBytes(b.maxValue)
		suf.WriteString(repeat(" ", 6-len(maxValue)))
		suf.WriteString(maxValue)
	} else {
		maxValue := format.HumanBytes(b.maxValue)
		suf.WriteString(repeat(" ", 6-len(maxValue)))
		suf.WriteString(maxValue)
		suf.WriteString(repeat(" ", 7))
	}

	rate := b.rate()
	// max 10 characters: "  999 MB/s"
	if b.stopped.IsZero() && rate > 0 {
		suf.WriteString("  ")
		humanRate := format.HumanBytes(int64(rate))
		suf.WriteString(repeat(" ", 6-len(humanRate)))
		suf.WriteString(humanRate)
		suf.WriteString("/s")
	} else {
		suf.WriteString(repeat(" ", 10))
	}

	// max 8 characters: "  59m59s"
	if b.stopped.IsZero() && rate > 0 {
		suf.WriteString("  ")
		var remaining time.Duration
		if rate > 0 {
			remaining = time.Duration(int64(float64(b.maxValue-b.currentValue)/rate)) * time.Second
		}

		humanRemaining := formatDuration(remaining)
		suf.WriteString(repeat(" ", 6-len(humanRemaining)))
		suf.WriteString(humanRemaining)
	} else {
		suf.WriteString(repeat(" ", 8))
	}

	var mid strings.Builder
	// add 5 extra spaces: 2 boundary characters and 1 space at each end
	f := termWidth - pre.Len() - suf.Len() - 5
	n := int(float64(f) * b.percent() / 100)