Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/cli/spin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import (
"github.com/briandowns/spinner"
)

var nonTTYTickInterval = 30 * time.Second

func Spin(message string, tty bool, out io.Writer) func() {
if tty {
indicator := spinner.New(spinner.CharSets[11], 100*time.Millisecond, spinner.WithWriter(out))
indicator.Suffix = " " + message
indicator.Start()
return indicator.Stop
} else {
ticker := time.NewTicker(1 * time.Second)
ticker := time.NewTicker(nonTTYTickInterval)
fmt.Fprintln(out, message)
go func() {
for range ticker.C {
Expand All @@ -42,7 +44,7 @@ func SpinUntilDone(message string, tty bool, out io.Writer) func(finalMsg string
indicator.Stop()
}
} else {
ticker := time.NewTicker(1 * time.Second)
ticker := time.NewTicker(nonTTYTickInterval)
fmt.Fprintln(out, message)
go func() {
for range ticker.C {
Expand Down