tui

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Add    key.Binding
	Edit   key.Binding
	Delete key.Binding
	Apply  key.Binding
	Quit   key.Binding
	Help   key.Binding
}

KeyMap defines the keybindings for the TUI

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns the full set of keybindings

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns keybinding help

type Model

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

Model represents the state of the TUI application

func NewModel

func NewModel(client *api.Client) Model

NewModel creates a new TUI model

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the TUI model

func (Model) Start

func (m Model) Start() error

Start initializes and runs the TUI

func (Model) Update

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

Update handles user input and updates the model

func (Model) View

func (m Model) View() string

View renders the TUI

type StyleConfig

type StyleConfig struct {
	// General styles
	Header   lipgloss.Style
	Section  lipgloss.Style
	Title    lipgloss.Style
	Subtitle lipgloss.Style
	Normal   lipgloss.Style
	Bold     lipgloss.Style
	Dimmed   lipgloss.Style

	// Status styles
	Success lipgloss.Style
	Warning lipgloss.Style
	Error   lipgloss.Style
	Info    lipgloss.Style

	// Action styles
	Add    lipgloss.Style
	Update lipgloss.Style
	Remove lipgloss.Style
	Count  lipgloss.Style

	// Content styles
	Hostname    lipgloss.Style
	IP          lipgloss.Style
	Description lipgloss.Style
	DryRun      lipgloss.Style

	// Table styles
	TableStyles table.Styles
}

StyleConfig contains all the styles used in the application

func DefaultStyles

func DefaultStyles() StyleConfig

DefaultStyles returns the default style configuration

type UI

type UI struct {
	Styles StyleConfig
}

UI provides common UI rendering functions for all commands

func NewUI

func NewUI() *UI

NewUI creates a new UI with default styles

func (*UI) RenderDescription

func (ui *UI) RenderDescription(description string) string

RenderDescription renders a description

func (*UI) RenderDryRun

func (ui *UI) RenderDryRun() string

RenderDryRun renders a dry run indicator

func (*UI) RenderError

func (ui *UI) RenderError(err error) string

RenderError renders an error message

func (*UI) RenderHostname

func (ui *UI) RenderHostname(hostname string) string

RenderHostname renders a hostname

func (*UI) RenderIP

func (ui *UI) RenderIP(ip string) string

RenderIP renders an IP address

func (*UI) RenderInfo

func (ui *UI) RenderInfo(message string) string

RenderInfo renders an info message

func (*UI) RenderKeyValue

func (ui *UI) RenderKeyValue(key, value string) string

RenderKeyValue renders a key-value pair

func (*UI) RenderSection

func (ui *UI) RenderSection(title string) string

RenderSection renders a section title

func (*UI) RenderSeparator

func (ui *UI) RenderSeparator() string

RenderSeparator renders a horizontal separator line

func (*UI) RenderSuccess

func (ui *UI) RenderSuccess(message string) string

RenderSuccess renders a success message

func (*UI) RenderTitle

func (ui *UI) RenderTitle(title string, emoji string) string

RenderTitle renders a title with optional emoji

func (*UI) RenderWarning

func (ui *UI) RenderWarning(message string) string

RenderWarning renders a warning message

Jump to

Keyboard shortcuts

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