Can rlwrap use a wrapped command's own TAB com

2020-02-06 23:48发布

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

2条回答
地球回转人心会变
2楼-- · 2020-02-07 00:22

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.

查看更多
Deceive 欺骗
3楼-- · 2020-02-07 00:28

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.

查看更多
登录 后发表回答