Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用Golang开发的交互式命令行组件库 #59

Open
fzdwx opened this issue Aug 12, 2022 · 0 comments
Open

用Golang开发的交互式命令行组件库 #59

fzdwx opened this issue Aug 12, 2022 · 0 comments
Labels
recommend 每日一库推荐

Comments

@fzdwx
Copy link

fzdwx commented Aug 12, 2022

推荐项目

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

  • 类别:Go

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

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

  • 亮点:

    • 提供一系列开箱即用的组件
      • autocomplete
      • progress bar / progress-bar group
      • multi/single select
      • spinner
      • confirm
      • input
    • 支持 window/linux (我现在只有这两种操作系统)
    • 可定制,你可以替换组件中的某些选项或方法为你自己的实现
    • 可组合,你可以将一个或多个基础组件联合在一起使用
      • autocompleteinputselection 组成
      • selection 通过嵌入input 来实现过滤功能.
  • 示例代码
    这个 一个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!")
}
  • 截图:

autocomplete:
demo

print
demo

multi select
image

progress bar
image

confirm
image

@darjun darjun added the recommend 每日一库推荐 label Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recommend 每日一库推荐
Projects
None yet
Development

No branches or pull requests

2 participants