-
Notifications
You must be signed in to change notification settings - Fork 38
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
Could TerminalDetection be made public? #171
Comments
I'm not quite following the description, could you give a short code example of what you're trying to do? |
I'm trying to simplify the process of doing progress tracking (on the JVM for now, but possibly in future for KMP libraries too).
The problem here is that to redirect stdout I need a Terminal with a custom TerminalInterface, but to implement TerminalInterface I need a TerminalInfo, but to get a TerminalInfo I need a Terminal. So there's a loop. |
I see, so your The only thing the |
It's public in the latest release. |
Thanks! |
I'm trying to port to Mordant 3 and it seems I still need to create a Terminal object twice, because the only way to implement what I want (System.out redirection into Mordant) requires me to wrap the TerminalInterface with an override that delegates to the real interface. But the only way to get the real interface is to create a |
I have an app where for various reasons it's convenient to call println() from code that doesn't know about Mordant (and shouldn't). To make this work I can redirect stdout so System.out goes to a PrintStream that prints via Mordant, and Mordant prints via the original stdout stream. Unfortunately this is awkward in the current API, because Terminal requires TerminalInterface requires TerminalInfo, but the only public way to get this object is .... Terminal. So you have to create Terminal twice. If TerminalDetection were public, this could be avoided.
Alternatively, it'd be good if Mordant could do this interception itself.
The text was updated successfully, but these errors were encountered: