module
Version:
v1.26.11
Opens a new window with list of versions in this module.
Published: Jul 10, 2026
License: Apache-2.0
Opens a new window with license information.
README
¶
interactx
终端交互库,提供 CLI 命令框架、交互式提示、颜色输出和文本对齐。
安装
go get github.com/go-xuan/interactx
快速开始
import (
"github.com/go-xuan/interactx/cmdx"
"github.com/go-xuan/interactx/promptx"
"github.com/go-xuan/interactx/colorx"
)
// 注册命令
cmd := cmdx.NewCommand("hello", "say hello")
cmd.Execute(func() { colorx.Green("Hello, World!") })
// 交互式选择
name, _ := promptx.Choose("请选择:", []string{"Alice", "Bob"})
子包
| 子包 |
用途 |
| alignx |
文本对齐与格式化 |
| cmdx |
CLI 命令框架(注册、参数解析、选项类型) |
| colorx |
终端颜色输出 |
| promptx |
交互式提示(输入、选择、确认) |
Directories
¶
Click to show internal directories.
Click to hide internal directories.