Skip to content
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

For (rl *Shell) Readline(), the input is from os.StdIn, does it support the user-specified io stream as the command input source #71

Open
81981266 opened this issue Oct 12, 2024 · 1 comment
Labels
enhancement New feature or request terminal

Comments

@81981266
Copy link

For (rl *Shell) Readline(), the input is from os.StdIn, does it support the user-specified io stream as the command input source

@maxlandon maxlandon added enhancement New feature or request terminal labels Nov 16, 2024
@maxlandon
Copy link
Member

Hello,

sorry for not answering earlier, I didn't have much time to work on this library.
So currently the input source is indeed bound to os.Stdin, because the shell also has to monitor for various cursor/terminal escape codes that happen to go through it.
In many cases those escape codes sent back to us by the terminal are mixed along any user-typed keys that would happen to be typed at the same time, and that is why the "key management engine" of this library only uses os.Stdin (it simplifies the code to some extent).

I'm not against giving the option to use another input stream, and it might indeed not be that difficult to implement while preserving the capabilities of this readline library, but I would need some specific example.
Could you provide one ? Maybe some code snippets along with it ?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request terminal
Projects
None yet
Development

No branches or pull requests

2 participants