我想实现一个程序,它提供了与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.
更多推荐
发布评论