cli icon indicating copy to clipboard operation
cli copied to clipboard

Send progress output to stderr instead of stdout

Open dipu989 opened this issue 1 year ago • 3 comments

Pull Request Description

Fix for Issue #388: Spinner Output Cleanup

This pull request addresses the issue described in GitHub issue #388, where the spinner output was generating unprintable characters.

Changes Made:

Initialized the spinner with a default stderr writer.
Redirected all spinner output to stderr, ensuring that it does not interfere with standard output.
This adjustment prevents any unprintable characters from appearing in the final output, enhancing the overall user experience when using the CLI.

Before Change - WhatsApp Image 2024-10-16 at 8 15 05 AM

After Change - Screenshot 2024-10-16 at 8 24 13 AM

Impact: This change improves the clarity and usability of the Civo CLI by ensuring that output for this particular command (with -wait flag) is formatted correctly in every case.

dipu989 avatar Oct 16 '24 03:10 dipu989

@uzaxirr @fernando-villalba For now, I have only proposed a solution for the command mentioned in the ticket. If this approach looks good, I can raise similar changes for subsequent commands that support the -wait flag as well.

dipu989 avatar Oct 16 '24 03:10 dipu989

Hi @dipu989 , i've seen we are already doing that, such as here

			s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
			s.Writer = os.Stderr

This could be done better in my opinion using the spinner.WithWriter function you used in this PR instead of a new line for setting the writer to Stderr.

If you will open a PR for that, I will be happy to review it

fulviodenza avatar May 06 '25 09:05 fulviodenza

I agree with @fulviodenza. I like this approach better than what we currently have.

giornetta avatar May 06 '25 13:05 giornetta