Documentation
¶
Overview ¶
Package prompt 简单的终端交互界面
Index ¶
- type Prompt
- func (p *Prompt) Bool(q string, def bool) (bool, error)
- func (p *Prompt) Map(q string, maps map[string]string, def ...string) (selected []string, err error)
- func (p *Prompt) Slice(q string, slice []string, def ...int) (selected []int, err error)
- func (p *Prompt) String(q, def string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Prompt ¶
type Prompt struct {
// contains filtered or unexported fields
}
Prompt 终端交互对象
func New ¶
New 声明 Prompt 变量
delim 从 input 读取内容时的分隔符,如果为空,则采用 \n; defaultColor 默认值的颜色,如果该值无效,则会 panic。
func (*Prompt) Map ¶
func (p *Prompt) Map(q string, maps map[string]string, def ...string) (selected []string, err error)
Map 输出一个单选问题,并获取用户的选择项
q 表示问题内容; maps 表示可选的问题列表; def 表示默认项的索引,必须在 maps 之内。
Click to show internal directories.
Click to hide internal directories.