最近写了一个用于开发交互式终端程序的库:
https://github.com/fzdwx/infi...
它相似js外面的Inquirer.js ,不过是用Golang写的。上面的demo是其中一个组件:autocomplete
编辑切换为居中demo它次要的个性有:
提供了一系列开箱即用的组件
- progress bar / progress bar group
- multi / single select
- input text
- spinner
- confirm
- 反对 linux / widnwos (我手上只有这两种操作系统)
基本上每个根底组件都提供了一些自定义的选项,你能够依据你的须要进行替换。
- 比如说多选 和单选 实际上都是基于selection 这个根底组件进行替换某些自定义选项而来的。
- input text 和confirm 也是基于同一个根底组件而来的。
能够组合应用,你能够将多个根底组件进行组合应用
- 根底组件有: inputselectionprogress barspinner 等
- autocomplete 这个组件是input + selection
- progress bar group 就是多个progress bar 组合
- selection 外面的过滤性能也用到了input
上面是一些运行示例:
如果有帮到你,心愿能点个star,如果遇到了bug,也欢送提issue,我会在第一工夫响应!
https://github.com/fzdwx/infi...