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
Automatically open terminal when Stdout is not a terminal #860
Comments
I would like to write code to solve this problem and create a pull request, but before I do so I would like to hear some design advice on how it should be implemented. |
Hi @wolfmagnate, I'm trying to use the workaround you mentioned and it seems that color formatting doesn't work when I pass I've reproduced the issue using two of examples in this repo. For For Outputs when running the commands normally as Gist with full code I used for both examples:
Do you have any pointers or advice on how to make all styles work? 🙏 Many thanks! |
It took me way too long to find this workaround. The first improvement may be to make this info a bit more accessible. Because of Gum, I expected this to be an out-of-the-box behaviour. Following the gum train of thought, I tried to model my program from it, but it's hard to follow since the call stack delves into Kong cli, which relies on reflection and other unsafe code. Learning the internals of a framework I won't even use seems like a step too far into procrastination so I am happy to find a workaround. If maybe any of you know how Gum is doing it, please let me know in this discussion thread. |
Is your feature request related to a problem? Please describe.
description
Currently, to redirect output results to another file or pipe them to another command is not supported. Therefore, if you write bubbles tea's standard output to a file with the current implementation, the file will have ANSI control characters written directly to it.
this problem is reported in #823 and #792.
why is this a problem?
Describe the solution you'd like
If the standard output of the bubble tea program is connected to something other than a terminal, the program will determine this at startup and change the destination of bubble tea's TUI to the terminal and the destination of stdout to the output specified at startup.
Add the following process
Describe alternatives you've considered
WithOutput
optionThis works on linux, but this is not crossplatform solution. Also, this is inconsistent interface because you don't have to write any code for input, but have to write for output.
Additional context
I am not sure where i should write the statements to solve this problem.
Currently, Program.output is initialized here. I should add the new process here in terms of extending the existing process.
Here is a program from tea.go that creates a new TTY for the input source. The input and output processing are similar in purpose and content, so I should add the processing here.
The text was updated successfully, but these errors were encountered: