From 049211d719574b9af8453b044d56625fa4af39af Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sat, 5 Apr 2025 14:24:07 -0700 Subject: Fix bugs --- cmd/progress-bar/progress-bar.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cmd') diff --git a/cmd/progress-bar/progress-bar.go b/cmd/progress-bar/progress-bar.go index 65079ef..25e6216 100644 --- a/cmd/progress-bar/progress-bar.go +++ b/cmd/progress-bar/progress-bar.go @@ -10,7 +10,7 @@ import ( "strconv" "time" - "gitlab.com/rhogenson/progress-bar/progress" + "gitlab.com/rhogenson/progress-bar" ) var n = flag.Duration("n", 2*time.Minute, "polling interval") @@ -21,12 +21,13 @@ func run() error { return errors.New("usage error") } maxStr := args[0] - maxVal, err := strconv.Atoi(maxStr) + maxInt, err := strconv.Atoi(maxStr) if err != nil { return fmt.Errorf("max: %s", err) } + maxFloat := float64(maxInt) cmd := args[1:] - bar := progress.New(maxVal) + bar := new(progress.Bar) for i := 0; ; i++ { outputBytes, err := exec.Command(cmd[0], cmd[1:]...).Output() if err != nil { @@ -38,7 +39,7 @@ func run() error { fmt.Println(err) continue } - bar.Set(output) + bar.Set(float64(output) / maxFloat) bar.Print() time.Sleep(*n) } -- cgit v1.3.1