29 ms·
Along the same lines, I find this little utility in standard linux repos to be amazing. Try it on ed: `rlwrap ed`. Package: rlwrap [...] Homepage: https:
by tpoacher 2y ago
Along the same lines, I find this little utility in standard linux repos to be amazing. Try it on ed: `rlwrap ed`.
Package: rlwrap
[...]
Homepage: https://github.com/hanslub42/rlwrap
Description-en: readline feature command line wrapper
This package provides a small utility that uses the GNU
readline library to allow the editing of keyboard input
for any other command. Input history is remembered
across invocations, separately for each command; history
completion and search work as in bash and completion
word lists can be specified on the command line.
- microtonal 2y agorlwrap is a life-saver. Back when I was a graduate student, I contributed a system that was written in SICStus Prolog 3. SICStus was (probably still is) a great Prolog interpreter, but its REPL interface was quite bare-bones. `rlwrap`-ing SICStus made it so much nicer!
- tristan957 2y agoI'm still not understanding rlwrap. Could you describe more about what I should notice running the ed command you posted.
- assbuttbuttass 2y agorlwrap provides line-editing capabilities including ctrl-a, ctrl-e, and up and down arrows to recall previous commands
- kragen 2y agorlwrap is fantastic. here's a multichannel text chat system for other people who can ssh to the same host, with command-line editing, cross-session history, and logging provided by rlwrap: #!/bin/sh # Simple chat system frontend, wrapping gyap in rlwrap and maybe ssh. : ${GYAP_LOGFILE=$HOME/gyap.log} ${GYAP_COMMAND=gyap} if [ "$#" -eq 0 ]; then rlwrap -C gyap -l "$GYAP_LOGFILE" "$GYAP_COMMAND" "$@" else host=$1; shift rlwrap -C gyap -l "$GYAP_LOGFILE" ssh "$host" "$GYAP_COMMAND" "$@" fi the actual chat system is another 10-line shell script called `gyap` #!/bin/sh : Simple chat system. cf. rgyap. ${nick=${1-$USER}} ${chan=${2-/var/tmp/chat}} echo "Chatting on $chan as <$nick> (override with $0 \$nick [\$chan])" touch "$chan" && chmod 666 "$chan" 2>/dev/null sign() { echo "$(date +%T) * $nick signed $1 ($(date +%05Y-%m-%d))" >> "$chan" } echo "Press ^R if a chat line appears as you are typing. Recently:" tail -Fn 16 "$chan" & pid=$?; trap "sign off; sleep .1; kill $pid" 0 sign on; while read t; do echo "$(date +%T) <$nick> $t"; done >> "$chan" from http://canonical.org/~kragen/sw/dev3/gyap http://canonical.org/~kragen/sw/dev3/gyap and http://canonical.org/~kragen/sw/dev3/rgyap http://canonical.org/~kragen/sw/dev3/rgyap it's not secure of course; anyone can spoof anyone else or fill up your /var/tmp disk, or read the log without signing onto the channel it would be nice to have rlwrap options to customize tab-completion, for example for expanding to recently-mentioned nicks or slapping someone around a bit with a large trout