summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
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)
}