有没有类似于 GNU readline 的 .Net 库?
我正在考虑用 C# 编写一个控制台应用程序,我想合并历史记录、完成和命令行编辑功能,例如 GNU readline(但不一定那么广泛!)
是否有现有的 .net 库提供这种类型的功能功能?我想一种选择是使用互操作服务来调用 GNU readline。但有原生选项吗?
I'm considering writing a console application in C# and I want to incorporate history, completion and command line editing features something like GNU readline (but not necessarily as extensive as that!)
Is there an existing library for .net which provides this type of functionality? I guess one option would be to use interop services to call GNU readline. But is there a native option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可能需要查看 Miguel de Icaza 的 getline.cs (链接在博客文章中已损坏,现在可以找到代码 这里)。根据您实际需要的 readline 功能,它可能足以满足您的目的。
好处是,它全部包含在一个(因此是 getline.cs)文件中,并获得 MIT X11 许可。
使用它非常简单。
如果您想尝试一下,只需下载文件并编译它:
#ifdef DEMO
部分还显示了基本的 REPL:You may want to checkout Miguel de Icaza's getline.cs (the link in the blog post is broken, the code can now be found here). Depending on what features of readline you actually need, it might be enough for your purposes.
The nice thing is, that it is all contained in a single (hence getline.cs) file and MIT X11 licensed.
Using it is pretty easy.
If you want to give it try, just download the file and compile it:
The
#ifdef DEMO
part also shows the basic REPL:老问题,但仍然相关,因为它出现在谷歌搜索结果中。提及以下内容是有道理的:
https://github.com/tonerdo/readline 是一个很好的选择如今的选择。引用其自述文件:
许可
该项目已获得 MIT 许可
Old question, but still relevant since it appears in Google search results. It makes sense to mention the following:
https://github.com/tonerdo/readline is a good option nowadays. Quoting its README:
License
The project is licensed under the MIT license
我唯一知道的是 Mono-Readline。
它为 GNU Readline 库提供了一个 .NET 接口 - 虽然它有点原始,只有 0.0.1 版本,而且我只见过它在 Mono 运行时运行。
你也应该小心授权……据我所知,任何链接 GNU Readline 库的东西都需要在 GPL 下发布。
The only thing I know of is Mono-Readline.
It provides a .NET interface to the GNU Readline library - it's a bit raw though, only version 0.0.1, and I've only ever seen it run on the Mono runtime.
You should be careful with licensing too ... AFAIK anything that links the GNU Readline libraries is required to be released under the GPL.
旨在模拟 RedLine 大部分功能的项目是 Deveel ReadLine,但是我不得不说它没有维护。上次我使用它时,它在 .NET 和 Mono 上都运行得很好,尽管在取消自动折叠的行时存在一个小错误。
a project that aims to emulate most of the functions of RedLine is Deveel ReadLine, but I have to say that it isn't maintained. Last time I used it it worked very well on both .NET and Mono, although there's a small bug when canceling a line that was automatically folded.