最近写了一个用于开发交互式终端程序的库:
https://github.com/fzdwx/infinite
它类似js里面的Inquirer.js ,不过是用Golang写的。下面的demo是其中一个组件:autocomplete

它主要的特性有:
1. 提供了一系列开箱即用的组件
a. progress bar / progress bar group
b. multi / single select
c. input text
d. spinner
e. confirm
2. 支持 linux / widnwos (我手上只有这两种操作系统)
3. 基本上每个基础组件都提供了一些自定义的选项,你可以根据你的需要进行替换。
a. 比如说多选 和单选 实际上都是基于selection 这个基础组件进行替换某些自定义选项而来的。
b. input text 和confirm 也是基于同一个基础组件而来的。
4. 可以组合使用,你可以将多个基础组件进行组合使用
a. 基础组件有: input selection progress bar spinner 等
b. autocomplete 这个组件是input + selection
c. progress bar group 就是多个progress bar 组合
d. selection 里面的过滤功能也用到了input
下面是一些运行示例:




如果有帮到你,希望能点个star,如果遇到了bug,也欢迎提issue,我会在第一时间响应!
https://github.com/fzdwx/infinite