20 lines
406 B
Go
20 lines
406 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// Helper function to create string pointer
|
|
func ptr(s string) *string {
|
|
return &s
|
|
}
|
|
|
|
const progressBarLength = 20
|
|
|
|
func renderProgressBar(percent float64) string {
|
|
filled := int(float64(progressBarLength) * percent / 100)
|
|
bar := strings.Repeat("█", filled) + strings.Repeat(" ", progressBarLength-filled)
|
|
return fmt.Sprintf("[%s] %.0f%%", bar, percent)
|
|
}
|