ui

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Box

func Box(title, content string, width int) string

Box 绘制方框

func ErrorMessage

func ErrorMessage(msg string)

ErrorMessage 错误消息

func InfoMessage

func InfoMessage(msg string)

InfoMessage 信息消息

func StatusMessage

func StatusMessage(msg string)

StatusMessage 状态消息

func SuccessMessage

func SuccessMessage(msg string)

SuccessMessage 成功消息

func WarningMessage

func WarningMessage(msg string)

WarningMessage 警告消息

Types

type Color

type Color struct {
	Reset   string
	Bold    string
	Dim     string
	Black   string
	Red     string
	Green   string
	Yellow  string
	Blue    string
	Magenta string
	Cyan    string
	White   string
}

Color ANSI color codes

type ProgressBar

type ProgressBar struct {
	// contains filtered or unexported fields
}

ProgressBar 进度条

func NewProgressBar

func NewProgressBar(total int) *ProgressBar

NewProgressBar 创建新进度条

func (*ProgressBar) Complete

func (p *ProgressBar) Complete()

Complete 完成并换行

func (*ProgressBar) Draw

func (p *ProgressBar) Draw()

Draw 绘制进度条

func (*ProgressBar) Increment

func (p *ProgressBar) Increment() *ProgressBar

Increment 增加进度

func (*ProgressBar) SetColors

func (p *ProgressBar) SetColors(fg, bg string) *ProgressBar

SetColors 设置颜色

func (*ProgressBar) SetMessage

func (p *ProgressBar) SetMessage(msg string) *ProgressBar

SetMessage 设置消息

func (*ProgressBar) SetProgress

func (p *ProgressBar) SetProgress(current int) *ProgressBar

SetProgress 设置进度

func (*ProgressBar) SetShowPercent

func (p *ProgressBar) SetShowPercent(show bool) *ProgressBar

SetShowPercent 设置是否显示百分比

func (*ProgressBar) SetShowTimer

func (p *ProgressBar) SetShowTimer(show bool) *ProgressBar

SetShowTimer 设置是否显示计时器

func (*ProgressBar) SetWidth

func (p *ProgressBar) SetWidth(width int) *ProgressBar

SetWidth 设置宽度

type Spinner

type Spinner struct {
	// contains filtered or unexported fields
}

Spinner 旋转指示器

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner 创建新的旋转指示器

func (*Spinner) Error

func (s *Spinner) Error(msg string)

Error 显示错误

func (*Spinner) SetMessage

func (s *Spinner) SetMessage(msg string) *Spinner

SetMessage 设置消息

func (*Spinner) SetSpinner

func (s *Spinner) SetSpinner(chars []string) *Spinner

SetSpinner 设置旋转字符

func (*Spinner) Start

func (s *Spinner) Start() *Spinner

Start 开始显示

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop 停止显示

func (*Spinner) Success

func (s *Spinner) Success(msg string)

Success 显示成功

func (*Spinner) Warning

func (s *Spinner) Warning(msg string)

Warning 显示警告

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table 表格绘制

func NewTable

func NewTable(headers ...string) *Table

NewTable 创建新表格

func (*Table) AddRow

func (t *Table) AddRow(row ...string) *Table

AddRow 添加行

func (*Table) Print

func (t *Table) Print()

Print 打印表格

func (*Table) Render

func (t *Table) Render() string

Render 渲染表格

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL