tui

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Title style
	TitleStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(titleColor).
				MarginBottom(1)

	// Subtitle style
	SubtitleStyle = lipgloss.NewStyle().
					Foreground(subtleColor).
					MarginBottom(1)

	// Header style
	HeaderStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(primaryColor)

	// Status indicator styles
	MountedStyle = lipgloss.NewStyle().
					Foreground(successColor).
					Bold(true)

	UnmountedStyle = lipgloss.NewStyle().
					Foreground(dimColor)

	// Error style
	ErrorStyle = lipgloss.NewStyle().
				Foreground(errorColor).
				Bold(true)

	// Warning style
	WarningStyle = lipgloss.NewStyle().
					Foreground(warningColor)

	// Success style
	SuccessStyle = lipgloss.NewStyle().
					Foreground(successColor).
					Bold(true)

	// Border styles
	BorderStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(primaryColor)

	// List item styles
	NormalItemStyle = lipgloss.NewStyle().
					PaddingLeft(1).
					PaddingRight(1)

	SelectedItemStyle = lipgloss.NewStyle().
						PaddingLeft(1).
						PaddingRight(1).
						Background(lipgloss.Color("236"))

	// Cursor style
	CursorStyle = lipgloss.NewStyle().
				Foreground(accentColor).
				Bold(true)

	CursorArrowStyle = lipgloss.NewStyle().
						Foreground(titleColor).
						Bold(true)

	// Dimmed text
	DimStyle = lipgloss.NewStyle().
				Foreground(dimColor)

	SeparatorStyle = lipgloss.NewStyle().
					Foreground(subtleColor)

	// Help text style
	HelpStyle = lipgloss.NewStyle().
				Foreground(subtleColor).
				MarginTop(1)
)

Base styles

View Source
var (
	// Status badge
	StatusBadgeMounted = lipgloss.NewStyle().
						Foreground(lipgloss.Color("42")).
						Bold(true)

	StatusBadgeUnmounted = lipgloss.NewStyle()

	CheckMarkMountedStyle = lipgloss.NewStyle().
							Foreground(lipgloss.Color("42")).
							Bold(true)

	CheckMarkPendingStyle = lipgloss.NewStyle().
							Foreground(lipgloss.Color("117")).
							Bold(true)

	CheckMarkUnmountStyle = lipgloss.NewStyle().
							Foreground(lipgloss.Color("214")).
							Bold(true)

	// Table row styles
	TableRowStyle = lipgloss.NewStyle().
					Padding(0, 1)

	TableHeaderStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(primaryColor).
						Padding(0, 1).
						MarginBottom(1)

	// Info field labels
	LabelStyle = lipgloss.NewStyle().
				Foreground(primaryColor).
				Bold(true).
				MarginRight(1)

	// Info field values
	ValueStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("255"))

	// Command hint
	CommandHintStyle = lipgloss.NewStyle().
						Foreground(subtleColor).
						Italic(true)
)

Component styles

Functions

func DisplayList

func DisplayList(mounts []config.MountEntry) error

func RenderStatusBadge

func RenderStatusBadge(isMounted bool) string

RenderStatusBadge returns a styled status badge

func SelectEntry

func SelectEntry(title string, mounts []config.MountEntry, showStatus bool) ([]*config.MountEntry, bool)

SelectEntry 显示选择器并返回选中的条目(支持多选)

func SelectMountEntry

func SelectMountEntry(mounts []config.MountEntry) ([]*config.MountEntry, bool)

SelectMountEntry 显示挂载选择器(支持多选)

func SelectUnmountEntry

func SelectUnmountEntry(mounts []config.MountEntry) ([]*config.MountEntry, bool)

SelectUnmountEntry 显示卸载选择器(支持多选)

Types

type MountActionResult

type MountActionResult struct {
	ToMount   []*config.MountEntry
	ToUnmount []*config.MountEntry
	Cancelled bool
}

func SelectMountAction

func SelectMountAction(mounts []config.MountEntry) *MountActionResult

type SelectionResult

type SelectionResult struct {
	Entries []*config.MountEntry
	Cancel  bool
}

SelectionResult 是选择的结果

type SelectionState

type SelectionState int
const (
	SelNone SelectionState = iota
	SelMount
	SelUnmount
)

type SelectorModel

type SelectorModel struct {
	Title       string
	Mounts      []config.MountEntry
	Cursor      int
	Scroll      int
	Selected    []*config.MountEntry
	SelectedMap map[int]SelectionState
	Cancelled   bool
	Confirmed   bool
	Height      int
	Width       int
	ShowStatus  bool
	NoFallback  bool
}

SelectorModel 交互式选择的 BubbleTea 模型

func NewSelectorModel

func NewSelectorModel(title string, mounts []config.MountEntry, showStatus bool) SelectorModel

NewSelectorModel 创建新的选择器模型

func (SelectorModel) Init

func (m SelectorModel) Init() tea.Cmd

Init 初始化选择器模型

func (SelectorModel) Update

func (m SelectorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update 处理选择器模型的消息

func (SelectorModel) View

func (m SelectorModel) View() string

View 渲染选择器模型

Jump to

Keyboard shortcuts

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