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

问题描述

我想将 rlwrap 与自定义 erlang repl 一起使用.

I want to use rlwrap with a custom erlang repl.

如果我将它作为rlwrap -a myrepl"运行,它会完美运行.

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

问题是 myrepl 具有内置的 tab 补全功能,但会被 rlwrap 践踏.

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

我想让 rlwrap 释放 TAB 键

I want to make rlwrap to release the TAB key

推荐答案

你不能同时使用 rlwrap 的行编辑/历史和你的 repl 的 TAB 补全.

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

rlwrap 为没有它的命令提供了行编辑、历史记录和(非常简单的)补全.具有 TAB 补全功能的命令不需要 rlwrap 进行行编辑,对吗?

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?

-a (--always-readline) 选项是一种相当粗略的方式来替换 rlwrap 的行编辑行为,命令.它主要用于具有非常简单的行编辑器的命令,例如没有命令历史

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

如果您想使用 -a 选项,因为您更喜欢 rlwrap 的幻想(如持久历史记录或彩色提示)而不是您的命令(如 TAB 完成), 继续吧,但不可能选择其中一种并保留另一种.

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.

这是程序(及其用户)为避免使用 readline 库和随附的 GPL 许可而必须支付的(小)价格.

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.

汉斯(rlwrap 作者)

编辑(2017 年 4 月):


Edit (April 2017):

在许多情况下,可以使用过滤器恢复完成.参见基于readline的节点shell示例

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.

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

06-13 21:41