本文介绍了可以使用包裹命令自己的TAB完成吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果我以rlwrap -a myrepl的形式运行,它的工作效果很好。



问题是myrepl有内置的选项卡完成,被rlwrap践踏。



我想让rlwrap释放TAB键

解决方案

您不能使用 rlwrap 的行编辑/历史记录您的repl的TAB完成同时。



rlwrap 提供行编辑,历史和(非常简单)完成不具有的命令。一个像TAB完成一样的命令不应该需要 rlwrap 来进行线编辑,应该是吗?



-a - always-readline )选项是一种相当粗暴的方法, / em> rlwrap的行编辑行为为您的命令。它主要用于具有非常简单的行编辑器的命令,无需例如命令历史



如果要使用 -a 选项,因为您更喜欢 rlwrap 的喜好(像持续的历史或彩色提示)到你的命令(如TAB完成),继续,但是不可能选择一些想法,并保持一些其他的。 >

这是(小)价格程序(及其用户)必须支付,以避免 readline 库和GPL许可证随之而来



汉斯( rlwrap 作者)





编辑(2017年4月):



在许多情况下,可以使用以恢复完成。有关示例,请参见基于readline的节点shell这个。


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

解决方案

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.

这篇关于可以使用包裹命令自己的TAB完成吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 17:21