Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spinner overwrites the previous line if it is not ended with "\n" #157

Open
medyagh opened this issue Apr 17, 2024 · 0 comments
Open

Spinner overwrites the previous line if it is not ended with "\n" #157

medyagh opened this issue Apr 17, 2024 · 0 comments

Comments

@medyagh
Copy link

medyagh commented Apr 17, 2024

Hello a few years ago we created this issue #121 and this PR #108

and we been using a fork of spinner for the issue that we have, however I would love to use the main repo,
admittedly at that time we didnt explain the issue Outside minikube context and here is my second attempt hopefully this time makes better sense :)

here is a simple code using the spanner

package main

import (
	"fmt"
	"os"
	"time"

	"github.com/briandowns/spinner"
)

func main() {
	_, err := fmt.Fprintf(os.Stdout, "Hello time world is %d:%d", 3, 4)
	if err != nil {
		fmt.Println("Error !")
	}
	s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
	s.Color("green")                                            
	s.Start()                   
	time.Sleep(4 * time.Second)
	s.Stop()                   

}

Output

(spinning without any text)

The Expected Output

Hello world time is 3:4 (Spinning)

Note that the spinner library is Overwriting the Hello...text, since it did NOT end with a "\n"

I also tried the Prefix

	s.Prefix = fmt.Sprintf("Hello world time is %d:%d", 3, 4)

,But whole text will vanish after the spinning is done. we want the "Hello world" text to stay after the spinning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant