-
Notifications
You must be signed in to change notification settings - Fork 13
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
Alternative writer interface func(string)
#28
Comments
Are you able to be more specific about the use case? I'm not sure I follow. Are you talking about when the output is piped? |
@theckman ya, happy to discuss more. Basically, my specific use case is I want to use yacspin within https://github.com/rivo/tview - That's a Terminal UI Framework. Since that framework is what "draws" on the screen, all I need from yacspin is the string that is produced, then notify There's some more details here including some example code: rivo/tview#462 |
@ghostsquad I'm fairly ignorant to how tview works, so apologies if I'm asking some obvious questions. I assume the code with If so, might it be better to say that the issue is Would you say that's a reasonable understanding of the situation and one of the potential solutions? Trying to make sure I fully grok the problem. :) |
You nailed it. With one caveat. You can't really use io.Writer since that assumes it's ok to just continue writing updates to the same stream. I need to know the "current" state of the spinner. |
Could you explain what you mean by needing to know the state? |
State == what should be on the screen at any given time |
@ghostsquad I am trying to understand whether this is a problem that should be solved by Being very transparent, I'm now following the problem and what you need to solve the problem. Why do you need to know what's supposed to be on screen? |
So that I can update the contents of |
Other clarifications. Since tview is a terminal gui, it would likely be running in a TTY, since that's it's primary use case. |
If you have a better way of providing an isolated "snapshot" of what the spinner should look like at any given moment, and provide that to the client. Then update that snapshot (not append, which is what is currently being done with io.Writer), I'm happy to hear it. But I'm pretty sure that's what my PR does. |
I'm not sure how else to explain it. Currently Yacspin supports only explicitly outputting to something like
|
sorry for bothering you. This is clearly outside the scope of what you intend for this repo. I found an exceedingly simple alternative here that has the flexibility I need. |
I was wondering if you would be interested in providing an alternative interface for writing, a
func(string)
in the config.This would allow support for some special cases when using a carriage return to "reset" the displayed string is not supported.
The text was updated successfully, but these errors were encountered: