summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-04-06 14:37:44 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-04-06 14:37:44 -0700
commit2949987666d8b104ea305734fe5e159d97434240 (patch)
tree9adab4dc76c390dec88ffd76b79d4155b12964bb /cmd
parent6fc34c4c3cbb68f6f7cb8049a6d68bd315c07984 (diff)
downloadprogress-bar-2949987666d8b104ea305734fe5e159d97434240.tar.zst
Bubbletea to make it pretty
Diffstat (limited to 'cmd')
-rw-r--r--cmd/progress-bar/progress-bar.go53
1 files changed, 0 insertions, 53 deletions
diff --git a/cmd/progress-bar/progress-bar.go b/cmd/progress-bar/progress-bar.go
deleted file mode 100644
index 19050c8..0000000
--- a/cmd/progress-bar/progress-bar.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package main
-
-import (
- "bytes"
- "errors"
- "flag"
- "fmt"
- "os"
- "os/exec"
- "strconv"
- "time"
-
- "gitlab.com/rhogenson/progress-bar"
-)
-
-var n = flag.Duration("n", 2*time.Minute, "polling interval")
-
-func run() error {
- args := flag.Args()
- if len(args) < 2 {
- return errors.New("usage error")
- }
- maxStr := args[0]
- maxVal, err := strconv.Atoi(maxStr)
- if err != nil {
- return fmt.Errorf("max: %s", err)
- }
- cmd := args[1:]
- bar := progress.New(maxVal)
- for i := 0; ; i++ {
- outputBytes, err := exec.Command(cmd[0], cmd[1:]...).Output()
- if err != nil {
- fmt.Println(err)
- continue
- }
- output, err := strconv.Atoi(string(bytes.TrimSuffix(outputBytes, []byte("\n"))))
- if err != nil {
- fmt.Println(err)
- continue
- }
- bar.Set(output)
- bar.Print()
- time.Sleep(*n)
- }
-}
-
-func main() {
- flag.Parse()
- if err := run(); err != nil {
- fmt.Fprintln(os.Stderr, err)
- os.Exit(1)
- }
-}