ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconSuccess    = "✓"
	IconFailure    = "✗"
	IconWarning    = "⚠"
	IconSpinner    = "⠋"
	IconPrompt     = "◆"
	IconSelected   = "●"
	IconUnselected = "○"
	IconChecked    = "[x]"
	IconUnchecked  = "[ ]"
	IconPull       = "↑"
	IconPush       = "↓"
	IconNoChange   = "="
)

Icons used throughout the CLI output.

View Source
const (
	BoxTop    = "┌"
	BoxMiddle = "│"
	BoxBottom = "└"
)

Box-drawing characters for section framing.

Variables

View Source
var (
	StyleSuccess    lipgloss.Style
	StyleError      lipgloss.Style
	StyleWarning    lipgloss.Style
	StyleInfo       lipgloss.Style
	StylePath       lipgloss.Style
	StyleEncryption lipgloss.Style
	StyleSecondary  lipgloss.Style
)

Lipgloss styles for consistent terminal output.

View Source
var ErrNonInteractive = errors.New("non-interactive terminal")

ErrNonInteractive is returned when a prompt requires user input but the terminal is not interactive.

Functions

func Confirm

func Confirm(label string, defaultYes bool) (bool, error)

Confirm asks a yes/no question. In non-interactive mode, returns defaultYes.

func IsInteractive

func IsInteractive() bool

IsInteractive reports whether the terminal supports interactive prompts.

func LogError

func LogError(msg string)

LogError prints an error message with a red cross.

func LogErrorf

func LogErrorf(format string, a ...any)

LogErrorf prints a formatted error message.

func LogInfo

func LogInfo(msg string)

LogInfo prints an informational message.

func LogInfof

func LogInfof(format string, a ...any)

LogInfof prints a formatted informational message.

func LogSuccess

func LogSuccess(msg string)

LogSuccess prints a success message with a green checkmark.

func LogSuccessf

func LogSuccessf(format string, a ...any)

LogSuccessf prints a formatted success message.

func LogWarning

func LogWarning(msg string)

LogWarning prints a warning message with a yellow indicator.

func LogWarningf

func LogWarningf(format string, a ...any)

LogWarningf prints a formatted warning message.

func MultiSelect

func MultiSelect(label string, options []string) ([]int, error)

MultiSelect presents a list of options with checkboxes and returns the indices of selected items.

func SectionBlank

func SectionBlank()

SectionBlank prints an empty continuation line.

func SectionEnd

func SectionEnd(msg string)

SectionEnd prints the closing line of a section.

func SectionLine

func SectionLine(msg string)

SectionLine prints a continuation line within a section.

func SectionStart

func SectionStart(title string)

SectionStart prints the opening line of a section.

func Select

func Select(label string, options []string) (int, error)

Select presents a list of options and returns the index of the chosen item.

func SetNoColor

func SetNoColor(v bool)

SetNoColor forces color output on or off. Intended for the --no-color flag.

func TextInput

func TextInput(label string, placeholder string) (string, error)

TextInput prompts the user for a text value.

Types

type Spinner

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

Spinner displays an animated loading indicator in the terminal.

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner creates a spinner with the given message.

func (*Spinner) Start

func (s *Spinner) Start()

Start begins the spinner animation. In non-interactive mode, prints a static message instead.

func (*Spinner) Stop

func (s *Spinner) Stop(msg string, success bool)

Stop ends the spinner and prints a final status message.

Jump to

Keyboard shortcuts

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