百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

go-prompt

> 开发工具
开源

在 Go 中构建强大的交互式提示符,灵感来自 Python-prompt-toolkit。

5.5K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

在 Go 中构建强大的交互式提示符,灵感来自 Python-prompt-toolkit。

go-prompt

一个用于构建强大交互式提示的库,灵感来自 Python-prompt-toolkit, 让使用 Go 构建跨平台命令行工具变得更加容易。

go
package main

import (
	"fmt"
	"github.com/c-bata/go-prompt"
)

func completer(d prompt.Document) []prompt.Suggest {
	s := []prompt.Suggest{
		{Text: "users", Description: "Store the username and age"},
		{Text: "articles", Description: "Store the article text posted by user"},
		{Text: "comments", Description: "Store the text commented to articles"},
	}
	return prompt.FilterHasPrefix(s, d.GetWordBeforeCursor(), true)
}

func main() {
	fmt.Println("Please select table.")
	t := prompt.Input("> ", completer)
	fmt.Println("You selected " + t)
}

使用 go-prompt 的项目

  • c-bata/kube-prompt : 一个用 Go 编写的、具有自动补全功能的交互式 Kubernetes 客户端。
  • rancher/cli : Rancher 命令行界面(CLI)是一个用于管理 Rancher 服务器的统一工具
  • kubicorn/kubicorn : 简单的、云原生的 Kubernetes 基础设施。
  • cch123/asm-cli : 基于 unicorn 和 rasm2 的汇编语言(X86/X64)交互式 shell
  • ktr0731/evans : 更具表现力的通用 gRPC 客户端
  • CrushedPixel/moshpit: 一个用于 datamoshing 的命令行工具。
  • last-ent/testy-go: Testy Go:一个让测试变得简单的工具!
  • tiagorlampert/CHAOS: 一个允许生成 payload 并控制远程操作系统的 PoC。
  • abs-lang/abs: ABS 是一种在终端上运行效果最佳的脚本语言。它试图将 Python 或 Ruby 等语言的优雅与 Bash 的便利性结合起来。
  • takashabe/btcli: btcli 是一个 Bigtable 的 CLI 客户端。具有多种读取选项和自动补全功能。
  • [ysn2233/kafka-prompt: 一个基于 existin 构建的交互式 kafka-prompt(kafka-shell)

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goclicommand-lineinteractiveprompt

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具