CLI解决方案的最佳实践(The best practice of CLI solution in go)

编程入门 行业动态 更新时间:2024-10-27 22:27:00
CLI解决方案的最佳实践(The best practice of CLI solution in go)

我想实现一个程序,它提供了与CLI类似的交互式shell体验。 我一直在尝试https://github.com/bobappleyard/readline,但它需要用户安装GNU readline并在OSX中导致一些错误。

在没有cgo情况下是否还有其他解决方案可以实现,因此用户不需要另外安装GNU readline ?

I want to implement a program that provides interactive-shell like experience with CLI. I have been trying https://github.com/bobappleyard/readline but it needs users to install GNU readline and it causes some bugs in OSX.

Is there any other solution implemented in go without cgo so users do not need to install GNU readline additionally?

最满意答案

我使用了github.com/peterh/liner的衬垫库,并取得了一些成功。

它是一个纯粹的Go包,不依赖于readline,适用于windows / linux / os x。

有关详细信息,请参阅文档 。


还有github.com/chzyer/readline ,它看起来也非常称职 - 但我还没试过那个。 文档在这里 。

I've used the liner library from github.com/peterh/liner with some success for this.

It is a pure Go package with no dependencies on readline and works on windows/linux/os x.

See the docs for more info.


There is also github.com/chzyer/readline which looks very competent too - but I haven't tried that one. Docs are here.

更多推荐

本文发布于:2023-07-28 21:51:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1309448.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   CLI   solution   practice

发布评论

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

>www.elefans.com

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