ui

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconCheck   = "✓"
	IconCross   = "✗"
	IconArrow   = "→"
	IconBolt    = "⚡"
	IconPackage = "📦"
	IconRocket  = "🚀"
	IconFolder  = "📁"
	IconBranch  = "🌿"
	IconSparkle = "✨"
	IconWarning = "⚠"
	IconInfo    = "ℹ"
	IconTree    = "├─"
	IconTreeEnd = "└─"
)

Icons using Unicode characters

View Source
const (
	BoxTopLeft     = "┌"
	BoxTopRight    = "┐"
	BoxBottomLeft  = "└"
	BoxBottomRight = "┘"
	BoxHorizontal  = "─"
	BoxVertical    = "│"
	BoxCross       = "┼"
	BoxTeeDown     = "┬"
	BoxTeeUp       = "┴"
	BoxTeeRight    = "├"
	BoxTeeLeft     = "┤"
)

Box drawing characters

Variables

View Source
var (
	// Primary colors
	Success = color.New(color.FgGreen, color.Bold)
	Error   = color.New(color.FgRed, color.Bold)
	Warning = color.New(color.FgYellow, color.Bold)
	Info    = color.New(color.FgCyan)
	Muted   = color.New(color.Faint)
	Bold    = color.New(color.Bold)

	// Accent colors
	Primary = color.New(color.FgBlue, color.Bold)
	Accent  = color.New(color.FgMagenta)
)

Color scheme for the TUI

Functions

func DrawBox added in v0.2.0

func DrawBox(title string, width int)

DrawBox creates a simple box around text

func Input added in v0.2.0

func Input(title, placeholder string) (string, error)

Input shows an interactive text input

func InputWithOptions added in v0.2.0

func InputWithOptions(title, placeholder string, options []SelectOption) (string, error)

InputWithOptions shows an interactive input with selectable options

func Mute added in v0.2.0

func Mute(text string) string

Muted text helper

func PrintError added in v0.2.0

func PrintError(message string)

func PrintInfo added in v0.2.0

func PrintInfo(message string)

func PrintProgress added in v0.2.0

func PrintProgress(current, total int, message string)

Progress indicator helpers

func PrintStep added in v0.2.0

func PrintStep(icon, message string)

func PrintSubStep added in v0.2.0

func PrintSubStep(message string)

func PrintSubStepEnd added in v0.2.0

func PrintSubStepEnd(message string)

func PrintSuccess added in v0.2.0

func PrintSuccess(message string)

Styled prints

func PrintWarning added in v0.2.0

func PrintWarning(message string)

func Select added in v0.2.0

func Select(title string, options []SelectOption) (string, error)

Select shows an interactive selection menu and returns the selected value

Types

type Console

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

Console implements Prompter for terminal interaction

func NewConsole

func NewConsole() *Console

NewConsole creates a new Console prompter

func (*Console) Confirm

func (c *Console) Confirm(message string) bool

func (*Console) ConfirmYes added in v0.2.3

func (c *Console) ConfirmYes(message string) bool

func (*Console) Input

func (c *Console) Input(prompt, defaultValue string) string

func (*Console) Print

func (c *Console) Print(message string)

func (*Console) Printf

func (c *Console) Printf(format string, args ...interface{})

type Prompter

type Prompter interface {
	Confirm(message string) bool
	ConfirmYes(message string) bool
	Input(prompt, defaultValue string) string
	Print(message string)
	Printf(format string, args ...interface{})
}

Prompter handles user interaction

type SelectOption added in v0.2.0

type SelectOption struct {
	Label    string
	Value    string
	Disabled bool
}

type Silent

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

Silent implements Prompter with auto-confirm (for -f flag or tests)

func NewSilent

func NewSilent(autoConfirm bool) *Silent

func (*Silent) Confirm

func (s *Silent) Confirm(message string) bool

func (*Silent) ConfirmYes added in v0.2.3

func (s *Silent) ConfirmYes(message string) bool

func (*Silent) Input

func (s *Silent) Input(prompt, defaultValue string) string

func (*Silent) Print

func (s *Silent) Print(message string)

func (*Silent) Printf

func (s *Silent) Printf(format string, args ...interface{})

type Spinner added in v0.2.0

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

Spinner provides a simple loading animation

func NewSpinner added in v0.2.0

func NewSpinner(message string) *Spinner

NewSpinner creates a spinner with dots animation

func (*Spinner) Fail added in v0.2.0

func (s *Spinner) Fail(message string)

Fail stops the spinner and prints an error message

func (*Spinner) Start added in v0.2.0

func (s *Spinner) Start() *Spinner

Start begins the spinner animation

func (*Spinner) Stop added in v0.2.0

func (s *Spinner) Stop()

Stop stops the spinner and clears the line

func (*Spinner) Success added in v0.2.0

func (s *Spinner) Success(message string)

Success stops the spinner and prints a success message

func (*Spinner) Update added in v0.2.0

func (s *Spinner) Update(message string)

Update changes the spinner message

type Table added in v0.2.0

type Table struct {
	Headers []string
	Rows    [][]string
	// contains filtered or unexported fields
}

Table creates a formatted table with box drawing characters

func NewTable added in v0.2.0

func NewTable(headers ...string) *Table

func (*Table) AddRow added in v0.2.0

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

func (*Table) Render added in v0.2.0

func (t *Table) Render()

Jump to

Keyboard shortcuts

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