[salt/printer] Spinner does not allow customising writer
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start at the Go printer package and the printer.Spin() entry point; trace how it selects STDOUT and how formatting functions emit output. Done means callers can provide a writer, including STDERR or a no-op, without spinner residue in redirected STDOUT; assess the broader streaming-encoding refactor separately.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
The printer.Spin() function assumes writer is STDOUT and does not allow overriding it. Showing spinner in STDOUT can cause issues when the program also writes other useful data (may be structured) to STDOUT.
# This type of usage will be common but with spinner on STDOUT, it may end up writing some
# residual characters used for the spinner rendering into the file also.
$ myprogram-using-spinner dosomework > foo.json
Describe the solution you'd like
Usually, it's better to use STDERR in for logs, progress updates, etc. or at-least if the writer itself is configurable, the client program can override the writer to implement any behaviour (no-op, write-to-stderr, write-to-stdout, etc.)
Note: The printer package seem to be assuming STDOUT for almost everything. Also, formatting functions encode into byte slice and then print. Instead, all these can be refactored to accept writer and stream-encode (e.g., json.NewEncoder(writer).Encode(v) )
- Dominant language
- Go
- Stars
- 14
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raystack/salt
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100