implement progress bar
This commit is contained in:
13
app/misc.go
13
app/misc.go
@@ -1,6 +1,19 @@
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user