Skip to content

Commit

Permalink
remove Spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
gitsrc committed May 23, 2022
1 parent a617665 commit 4026b1c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
discovery
.DS_Store
.idea
.idea
*.yaml
discovery-p2p
24 changes: 0 additions & 24 deletions cli/root.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package cli

import (
"fmt"
"log"
"sync"
"time"

"github.com/DataDrake/cli-ng/v2/cmd"
)
Expand Down Expand Up @@ -38,24 +35,3 @@ func checkErr(err error) {
log.Fatal(err)
}
}

// Spinner is an array of the progression of the spinner.
var Spinner = []string{"|", "/", "-", "\\"}

// SpinnerWait displays the actual spinner
func SpinnerWait(done chan int, message string, wg *sync.WaitGroup) {
ticker := time.NewTicker(time.Millisecond * 128)
frameCounter := 0
for {
select {
case <-done:
wg.Done()
return
default:
<-ticker.C
ind := frameCounter % len(Spinner)
fmt.Printf("\r[%v] "+message, Spinner[ind])
frameCounter++
}
}
}

0 comments on commit 4026b1c

Please sign in to comment.