kkawakam / rustyline

Readline Implementation in Rust
https://crates.io/crates/rustyline/
MIT License
1.51k stars 173 forks source link

Support for arbitrary streams for input/output #542

Open slashrsm opened 3 years ago

slashrsm commented 3 years ago

It seems that rustyline currently only supports standard input/output. Goose will accept connections via telnet and expose a command line interface, which allows users to control their load tests. We would like to use rustyline to improve the UX of the said command line, but we would need to be able to wire it into a TCP stream instead of stdin/stdout.

The idea of supporting arbitrary streams was already floated in #377. This approach would allow us to achieve what we want while also opening a lot of other possibilities for the library.

Is this something that would be considered? Are there any plans to do that already?

gwenn commented 3 years ago

Like https://github.com/jline/jline3/tree/master/remote-ssh/src/main/java/org/jline/builtins/ssh or https://github.com/prompt-toolkit/python-prompt-toolkit/tree/master/examples/ssh ?

slashrsm commented 3 years ago

Yes, something like this.

gwenn commented 3 years ago

I have no idea how jline3 / python-prompt-toolkit support ssh / telnet session. Maybe only the Terminal implementation differs ?

slashrsm commented 3 years ago

Possibly another implementation of the Term trait? Additionally to the Windows and Unix ones that we have already?

gwenn commented 3 years ago

In this case, we need a cargo feature to activate the ssh / telnet implementation.

slashrsm commented 3 years ago

Agreed. Are you generally prepared to accept this feature if I give it a try?

gwenn commented 3 years ago

If only tty module is impacted and all new dependencies are optional except when this feature is activated, I am ok.

slashrsm commented 3 years ago

OK, I will give it a try and see where it takes me. Thank you for the fast response!

m-mueller678 commented 2 years ago

I implemented this here by adding a new variant to config::Behaviour that allows the user to specify file descriptors to use. Would you like me to file a PR?