有没有 Readline 的简单替代方案?

发布于 2024-08-14 11:28:16 字数 1539 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

冬天的雪花 2024-08-21 11:28:16

编辑行。它有 BSD 风格的许可证。

编辑: 旧版本的 editline 非常简单。这是一个只有两个 C 文件和一个标头,总共约1500行代码。我们已经使用它很多年了。

Editline. It has a BSD-style license.

EDIT: Older versions of editline were quite simple. Here's one with just two C files and a header, a total of about 1500 lines of code. We've been using it for years.

落墨 2024-08-21 11:28:16

我找到了一个。 Redis 的 antirez 提出了 linenoise,这是一个更简单的替代方案。

I found one. antirez of Redis fame has come up with linenoise, a much simpler alternative.

自在安然 2024-08-21 11:28:16

大多数系统都安装了 readline,所以我不认为这是一个太大的问题。

其次,我不认为 GNU Readline 库有任何直接替代品。你必须坚持下去。 :(

编辑 5/11/2016:这个答案已经过时了,我所做的任何编辑几乎完全借用其他更正确的答案。摘要:参见 linenoiseeditline 用于现代阅读行替代方案。

Most systems have readline installed, so I don't see that as being too much of an issue.

Secondly, I don't think there's any drop-in replacement for the GNU Readline library. You're going to have to stick with it. :(

Edit 5/11/2016: This answer is outdated, and any edit I'd make would be borrowing almost completely from the other, more correct answers. Summary: see linenoise and editline for modern readline alternatives.

苏璃陌 2024-08-21 11:28:16

BusyBox 包含类似于 readline 的命令行编辑代码,但更小、更简单,完全支持 UTF-8。将其变成一个独立的库可能很容易。

BusyBox contains command line editing code similar to readline, but much smaller and simpler, with full support for UTF-8. It would probably be easy to make it into an independent library.

时光倒影 2024-08-21 11:28:16

editline 库是另一种选择。来自 自述文件

editline 库由 Simmule Turner 和 Rich Salz 于 1992 年创建。
当时他们选择以“类似 C News”的版权来分发代码,
有关详细信息,请参阅文件 LICENSE。

[...]

这个版本的 editline 库是 Minix3 源代码的一个分支。其他
通常基于原始 comp.sources.unix 发布的已知版本是:

每个分支中最有趣的补丁和错误修复已合并到此处。

The editline library is yet another alternative. From the README:

The editline library was created by Simmule Turner and Rich Salz back in 1992.
At the time they chose to distribute the code under a "C News-like" copyright,
see the file LICENSE for details.

[...]

This version of the editline library is a fork off the Minix3 sources. Other
know versions, often based off of the original comp.sources.unix posting are:

The most intersting patches and bug fixes from each fork have been merged here.

无人问我粥可暖 2024-08-21 11:28:16

editline(libedit) 尚不支持多字节字符。

我也同意 Dan Loewenherz 的观点,readline 图书馆分布广泛。例如,大多数 Linux 发行版都附带了 bash 和 readline。大多数 python 发行版还附带 readline。如果您的项目需要类似 readline 的库,那么最好使用 GNU readline 库,因为它是一个流行的选择,并且用户可能已经将其安装在操作系统上。

editline(libedit) doesn't support multi-byte characters yet.

I also agree with Dan Loewenherz, the readline library is wide spread. For example, most linux distribution ships bash with readline. Most python distribution also ships with readline. If your project needs a readline-like library, it's a good idea to use GNU readline library since it's a popular choice and users may have it installed on the OS already.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文