3 ms·
And if you ever find yourself using a command-line utility that doesn't have readline support (`tclsh` and `smlnj` come to mind), you can use `rlwrap`, availabl
by msarnoff 7y ago
And if you ever find yourself using a command-line utility that doesn't have readline support (`tclsh` and `smlnj` come to mind), you can use `rlwrap`, available via your package manager of choice:
rlwrap tclsh
and voila, no more `^[[C^[[D` spew.
- davidw 7y agoSigh... it always frustrated me that the Tcl folks never got something like readline integrated. IDK about the legal details, but Ruby and Python somehow managed. tkcon is an alternative, graphical shell for Tcl that's a good alternative to using tclsh on the command line, BTW.
- kevin_thibedeau 7y agoTclsh is only supposed to be a demo for embedding the interpreter. It consists of only 150 SLOC. Anyone could add readline if they really needed it. https://github.com/tcltk/tcl/blob/master/unix/tclAppInit.c https://github.com/tcltk/tcl/blob/master/unix/tclAppInit.c
- davidw 7y agoThis is like software marketing 101: You're going to have much happier users if you do that thing that "anyone could do" rather than ask that each person who might want to use readline read up on Tcl's C API and hack together something that links to readline.
- segmondy 7y agoI came to say this. rlwrap is so good. I honestly have never bothered using readline since I found rlwrap. I just wrap my command with it and move on.
- hyperpallium 7y agoThe first thing to know about rlwrap is that rlwrap is awesome.
- dvdkhlng 7y agoFor tclsh you can enable readline functionality via the tclreadline library. E.g. I have those lines in my ~/.tclshrc: if {$tcl_interactive} { package require tclreadline ::tclreadline::Loop }