summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-04-05 14:41:08 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-04-05 14:41:08 -0700
commit1d0f034c46d5bf73629b6480f8dbf4ec24e16375 (patch)
tree30ac547015a0ae4ab6b14afcf5e25fc15b764e10 /cmd
parent30773eed5febd93d0f0a52a35b21ccc24d2cc6c6 (diff)
downloadprogress-bar-1d0f034c46d5bf73629b6480f8dbf4ec24e16375.tar.zst
Use int instead of float
Diffstat (limited to 'cmd')
-rw-r--r--cmd/progress-bar/progress-bar.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd/progress-bar/progress-bar.go b/cmd/progress-bar/progress-bar.go
index 25e6216..19050c8 100644
--- a/cmd/progress-bar/progress-bar.go
+++ b/cmd/progress-bar/progress-bar.go
@@ -21,13 +21,12 @@ func run() error {
return errors.New("usage error")
}
maxStr := args[0]
- maxInt, err := strconv.Atoi(maxStr)
+ maxVal, err := strconv.Atoi(maxStr)
if err != nil {
return fmt.Errorf("max: %s", err)
}
- maxFloat := float64(maxInt)
cmd := args[1:]
- bar := new(progress.Bar)
+ bar := progress.New(maxVal)
for i := 0; ; i++ {
outputBytes, err := exec.Command(cmd[0], cmd[1:]...).Output()
if err != nil {
@@ -39,7 +38,7 @@ func run() error {
fmt.Println(err)
continue
}
- bar.Set(float64(output) / maxFloat)
+ bar.Set(output)
bar.Print()
time.Sleep(*n)
}