有没有一个.net库类似于GNU的readline?

编程入门 行业动态 更新时间:2024-10-25 04:20:52
本文介绍了有没有一个库类似于GNU的readline?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在考虑写在C#控制台应用程序,我想结合的历史,完成和命令行编辑功能类似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!)

是否有.NET现有的库,它提供了这种类型的功能?我想其中一个方案是使用互操作的服务调用GNU的readline。但有一个原生的选择吗?

Is there an existing library for 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?

推荐答案

您可能希望签米格尔·伊卡萨的的 getline.cs (在博客文章的链接被打破,code现在可以找到的这里)。根据readline的你实际需要的什么功能,它可能是足以让你的目的。

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.

的好处是,它是所有包含在一个单一的(因此getline.cs)文件和MIT X11许可。

The nice thing is, that it is all contained in a single (hence getline.cs) file and MIT X11 licensed.

使用它是pretty的方便。

Using it is pretty easy.

如果你想给它尝试,只要下载该文件,并进行编译:

If you want to give it try, just download the file and compile it:

C:\> csc.exe /d:DEMO getline.cs C:\> getline.exe shell>

在的#ifdef DEMO 部分还展示了基本REPL:

The #ifdef DEMO part also shows the basic REPL:

var le = new LineEditor("whatever"); string s; while ((s = le.Edit("my prompt> ", "")) != null) { // User input from command line / prompt now in "s". }

更多推荐

有没有一个.net库类似于GNU的readline?

本文发布于:2023-11-06 21:23:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564707.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类似于   net   readline   GNU

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!