Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
522 views
in Technique[技术] by (71.8m points)

autocomplete - Can rlwrap use a wrapped command's own TAB completion?

I want to use rlwrap with a custom erlang repl.

It works perfectly if I run it as "rlwrap -a myrepl".

The problem is that myrepl has builtin tab completion which gets trampled by rlwrap.

I want to make rlwrap to release the TAB key

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can't use rlwrap's line editing/history and your repl's TAB completion at the same time.

rlwrap provides line editing, history and (very simple) completion for commands that don't have it. A command that has something as fancy as TAB completion shouldn't need rlwrap to do its line editing, should it?

The -a (--always-readline) option is a rather crude way to substitute rlwrap's line editing behaviour for that of your command. It is primarily meant for commands that have a very simple line editor, without e.g. command history

If you want to use the -a option because you prefer rlwrap's fanciness (like persistent history, or coloured prompts) to your command's (like TAB completion), go ahead, but it is impossible to pick some fanciness of one and keep some of the other.

This is the (small) price programs (and their users) have to pay for avoiding the readline library and the GPL license that comes with it.

Hans (rlwrap author)


Edit (April 2017):

In many cases it will be possible to use a filter to restore completion. See A node shell based on readline for an example of this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...