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

筅森魡賤 提交于 2019-11-27 07:45:34

问题


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


回答1:


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.




回答2:


Rlwrap is cute. But in Erlang, it only offers persistent history while breaking erl's tab completion.

The fundamental issue is Erlang's erl REPL is just old and busted, and doesn't follow normal *nix conventions. Furthermore, they refuse to fix it because of fear of random, grouchy sysadmins whom can't accept any changes. No amount of rlwrap "duct-tape" hacks can fix a poor UX REPL.

It would be better (though significantly more work) to write a REPL from scratch like pry/ipython/etc. that does configurable color, tab completion, persistent history, paging, CLI observer, plugins, etc.

Rlwrap shines on programs with primitive shells.



来源:https://stackoverflow.com/questions/9210931/can-rlwrap-use-a-wrapped-commands-own-tab-completion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!