Documentation
¶
Index ¶
- Constants
- Variables
- func CenterText(text string, width int) string
- func RenderBox(content string, width int, style lipgloss.Style) string
- func RenderDivider(width int) string
- func StatusIcon(s types.TaskStatus) string
- func TruncateText(text string, maxWidth int) string
- type ErrorMsg
- type KeyMap
- type Model
- func (m Model) GetError() error
- func (m Model) GetFailedOutput() []string
- func (m Model) GetFailedTaskID() string
- func (m Model) GetFailedTaskName() string
- func (m *Model) Init() tea.Cmd
- func (m Model) IsFailed() bool
- func (m *Model) SetProgram(p *tea.Program)
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) View() string
- type OutputBatchMsg
- type OutputLine
- type OutputMsg
- type PipelineCompleteMsg
- type StageCompleteMsg
- type StageStartMsg
- type State
- type TaskProgressMsg
- type TaskStatus
- type TaskStatusMsg
- type TickMsg
Constants ¶
View Source
const ( StatusPending = types.StatusPending StatusRunning = types.StatusRunning StatusSuccess = types.StatusSuccess StatusFailed = types.StatusFailed StatusSkipped = types.StatusSkipped StatusCancelled = types.StatusCancelled )
重新导出状态常量
Variables ¶
View Source
var ( NewOutputMsg = types.NewOutputMsg NewOutputBatchMsg = types.NewOutputBatchMsg NewTaskStatusMsg = types.NewTaskStatusMsg NewTaskProgressMsg = types.NewTaskProgressMsg NewStageStartMsg = types.NewStageStartMsg NewStageCompleteMsg = types.NewStageCompleteMsg NewPipelineCompleteMsg = types.NewPipelineCompleteMsg NewErrorMsg = types.NewErrorMsg )
重新导出构造函数
View Source
var ( PrimaryColor = lipgloss.Color("#7D56F4") // 主色调 - 紫色 SecondaryColor = lipgloss.Color("#5B8DEF") // 次要色 - 蓝色 SuccessColor = lipgloss.Color("#73F59F") // 成功 - 绿色 WarningColor = lipgloss.Color("#EDFF82") // 警告 - 黄色 ErrorColor = lipgloss.Color("#FF6B6B") // 错误 - 红色 SubtleColor = lipgloss.Color("#383838") // 微妙色 - 深灰 TextColor = lipgloss.Color("#EEEEEE") // 文本色 - 浅灰 MutedColor = lipgloss.Color("#626262") // 静音色 - 中灰 )
颜色定义
View Source
var ( // 应用标题样式 AppTitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(PrimaryColor). Background(lipgloss.Color("#1a1a2e")). Padding(0, 1) // 版本号样式 VersionStyle = lipgloss.NewStyle(). Foreground(MutedColor). Italic(true) // 帮助提示样式 HelpStyle = lipgloss.NewStyle(). Foreground(MutedColor) // 分隔线样式 DividerStyle = lipgloss.NewStyle(). Foreground(SubtleColor) )
通用样式
View Source
var ( // 普通卡片边框 CardStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(PrimaryColor). Padding(1, 2) // 成功状态卡片 SuccessCardStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(SuccessColor). Padding(1, 2) // 错误状态卡片 ErrorCardStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ErrorColor). Padding(1, 2) // 运行中状态卡片 RunningCardStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(WarningColor). Padding(1, 2) )
卡片与边框样式
View Source
var ( // 标题样式 TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(TextColor). MarginBottom(1) // 副标题样式 SubtitleStyle = lipgloss.NewStyle(). Foreground(MutedColor) // 成功文本 SuccessTextStyle = lipgloss.NewStyle(). Foreground(SuccessColor) // 错误文本 ErrorTextStyle = lipgloss.NewStyle(). Foreground(ErrorColor) // 警告文本 WarningTextStyle = lipgloss.NewStyle(). Foreground(WarningColor) // 高亮文本 HighlightStyle = lipgloss.NewStyle(). Foreground(PrimaryColor). Bold(true) )
文本样式
View Source
var ( IconPending = lipgloss.NewStyle().Foreground(MutedColor).Render("○") IconRunning = lipgloss.NewStyle().Foreground(WarningColor).Render("●") IconSuccess = lipgloss.NewStyle().Foreground(SuccessColor).Render("✓") IconFailed = lipgloss.NewStyle().Foreground(ErrorColor).Render("✗") IconSkipped = lipgloss.NewStyle().Foreground(MutedColor).Render("⊘") IconArrow = lipgloss.NewStyle().Foreground(PrimaryColor).Render("→") IconBullet = lipgloss.NewStyle().Foreground(SecondaryColor).Render("•") IconSpinner = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"} )
状态图标
View Source
var ( StatusBarStyle = lipgloss.NewStyle(). Background(SubtleColor). Foreground(TextColor). Padding(0, 1) StatusItemStyle = lipgloss.NewStyle(). Foreground(TextColor). Padding(0, 1) StatusKeyStyle = lipgloss.NewStyle(). Foreground(MutedColor) StatusValueStyle = lipgloss.NewStyle(). Foreground(PrimaryColor). Bold(true) )
状态栏样式
View Source
var ( ProgressFilledStyle = lipgloss.NewStyle(). Foreground(PrimaryColor) ProgressEmptyStyle = lipgloss.NewStyle(). Foreground(SubtleColor) ProgressPercentStyle = lipgloss.NewStyle(). Foreground(TextColor). Width(6). Align(lipgloss.Right) )
进度条样式
View Source
var DefaultKeyMap = KeyMap{ Quit: key.NewBinding( key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "退出"), ), Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "上移"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "下移"), ), Enter: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "确认"), ), Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "帮助"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "取消"), ), ScrollUp: key.NewBinding( key.WithKeys("ctrl+u"), key.WithHelp("ctrl+u", "向上滚动"), ), ScrollDown: key.NewBinding( key.WithKeys("ctrl+d"), key.WithHelp("ctrl+d", "向下滚动"), ), PageUp: key.NewBinding( key.WithKeys("pgup"), key.WithHelp("pgup", "上一页"), ), PageDown: key.NewBinding( key.WithKeys("pgdown"), key.WithHelp("pgdown", "下一页"), ), Home: key.NewBinding( key.WithKeys("home"), key.WithHelp("home", "顶部"), ), End: key.NewBinding( key.WithKeys("end"), key.WithHelp("end", "底部"), ), }
DefaultKeyMap 默认快捷键配置
Functions ¶
Types ¶
type KeyMap ¶
type KeyMap struct {
Quit key.Binding
Up key.Binding
Down key.Binding
Enter key.Binding
Help key.Binding
Cancel key.Binding
ScrollUp key.Binding
ScrollDown key.Binding
PageUp key.Binding
PageDown key.Binding
Home key.Binding
End key.Binding
}
KeyMap 定义全局快捷键
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model 主 TUI Model
func (Model) GetFailedOutput ¶
GetFailedOutput 获取失败任务的输出日志
func (Model) GetFailedTaskName ¶
GetFailedTaskName 获取失败任务的名称
type OutputBatchMsg ¶ added in v0.0.6
type OutputBatchMsg = types.OutputBatchMsg
重新导出 types 包中的类型,保持向后兼容
type PipelineCompleteMsg ¶
type PipelineCompleteMsg = types.PipelineCompleteMsg
重新导出 types 包中的类型,保持向后兼容
Click to show internal directories.
Click to hide internal directories.