用Golang开发的交互式命令行(终端)组件库,progress bar,select,confirm,spinner...

推荐项目

  • 项目地址:https://github.com/fzdwx/infinite

  • 类别:Go

  • 项目标题:用Golang开发的交互式命令行组件库。

  • 项目描述:
    它提供了一些常用的交互式组件,比如说progress,progress group,mulit select,input text,confirm等.同时也提供了一些更基础的组件,方便用户进行组合使用。

  • 亮点:
    易于使用,定制化能力强,线程安全。

  • 示例代码
    这个 一个multi select的代码案例

package main

import (
	inf "github.com/fzdwx/infinite"
	"github.com/fzdwx/infinite/color"
	"github.com/fzdwx/infinite/components"
	"github.com/fzdwx/infinite/components/selection/multiselect"
	"github.com/fzdwx/infinite/style"
)

func main() {
	input := components.NewInput()
	input.Prompt = "Filtering: "
	input.PromptStyle = style.New().Bold().Italic().Fg(color.LightBlue)

	_, _ = inf.NewMultiSelect([]string{
		"Buy carrots",
		"Buy celery",
		"Buy kohlrabi",
		"Buy computer",
		"Buy something",
		"Buy car",
		"Buy subway",
	},
		multiselect.WithHintSymbol("x"),
		multiselect.WithUnHintSymbol("√"),
		multiselect.WithFilterInput(input),
	).Display("select your items!")
}
  • 截图:

multi select
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-VMsv6Lyz-1660016785950)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/c40aa414f3684673838b816bf46e2284~tplv-k3u1fbpfcp-zoom-1.image)]

progress bar
image

confirm
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-O4iGoE5S-1660016785952)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/8c81ebea184e4e04aea39cee9e9a0aef~tplv-k3u1fbpfcp-zoom-1.image)]

  • 后续更新计划:
  1. 目前项目还属于刚起步,需要做的事情很多。
  2. 提供更多的组件。
  3. 提供更多的使用案例。
  4. 提供组合使用的案例。
  5. 增强定制化的能力…
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值