Documentation
¶
Index ¶
- Constants
- Variables
- func DecodePNG(data []byte) (image.Image, error)
- type DialogStyle
- type HelpCmd
- type HelpSection
- type IconSet
- type InputConfig
- type KV
- type LinkCell
- type ListItem
- type Option
- type QR
- type QRResult
- type RegistrationResult
- type Theme
- type TreeNode
- type UI
- func (u *UI) BackupDone(path string, fileCount int) *UI
- func (u *UI) BackupStart(encrypted bool) *UI
- func (u *UI) Blank() *UI
- func (u *UI) Confirm(prompt string, helpText ...string) (bool, error)
- func (u *UI) ConfirmDefault(prompt string, defaultYes bool, helpText ...string) (bool, error)
- func (u *UI) DialogBox(style DialogStyle, title string, items []string, footer string) *UI
- func (u *UI) Divider() *UI
- func (u *UI) ErrorHint(problem, hint string) *UI
- func (u *UI) ErrorLine(msg string) *UI
- func (u *UI) FileLink(path string, isDir bool) string
- func (u *UI) Flush()
- func (u *UI) FlushAfter(fn func())
- func (u *UI) HelpScreen(sections []HelpSection) *UI
- func (u *UI) Image(pngData []byte) error
- func (u *UI) InfoLine(msg string) *UI
- func (u *UI) InitSuccess(configFile, adminUser, adminPassword string, nextSteps []ListItem)
- func (u *UI) Input(cfg InputConfig) (string, error)
- func (u *UI) KeyValue(label, value string) *UI
- func (u *UI) KeyValueBlock(title string, pairs []KV) *UI
- func (u *UI) KeyValueFile(label, path string, isDir bool) *UI
- func (u *UI) KeyValueLink(label, text, url string) *UI
- func (u *UI) Link(text, url string) string
- func (u *UI) LinkInline(text, url string) string
- func (u *UI) LinkList(title string, items []ListItem) *UI
- func (u *UI) Password(prompt string, opts ...prompter.Option) (*prompter.Result, error)
- func (u *UI) PasswordConfirm(prompt string) (*prompter.Result, error)
- func (u *UI) PasswordConfirmRequired(prompt string) (*prompter.Result, error)
- func (u *UI) PasswordConfirmWithHint(prompt, hint string) (*prompter.Result, error)
- func (u *UI) PasswordMinLength(prompt string, minLen int, errorMsg string) (*prompter.Result, error)
- func (u *UI) PasswordRequired(prompt string) (*prompter.Result, error)
- func (u *UI) PasswordRequiredWithHint(prompt, hint string) (*prompter.Result, error)
- func (u *UI) PasswordWithHint(prompt, hint string, confirm bool, opts ...prompter.Option) (*prompter.Result, error)
- func (u *UI) Println(s string) *UI
- func (u *UI) Prompt(prompt string, description ...string) string
- func (u *UI) PromptInline(prompt string) string
- func (u *UI) QR(content string) *QRResult
- func (u *UI) RegistrationForm(title, description string) (*RegistrationResult, error)
- func (u *UI) Render(fn func())
- func (u *UI) Reset()
- func (u *UI) RestoreDone(count int) *UI
- func (u *UI) SecretBox(label, value string) *UI
- func (u *UI) SectionHeader(label string) *UI
- func (u *UI) ServiceStatus(status, pid, configPath string) *UI
- func (u *UI) SimpleUserPass() (username, password string, err error)
- func (u *UI) Sprint(s string) string
- func (u *UI) StatusBadge(status string) *UI
- func (u *UI) Step(state, msg string) *UI
- func (u *UI) StepWithLink(state, msg, url string) *UI
- func (u *UI) String() string
- func (u *UI) SuccessLine(msg string) *UI
- func (u *UI) Table(headers []string, rows [][]string) *UI
- func (u *UI) TableWithLinks(headers []string, rows [][]interface{}) *UI
- func (u *UI) Theme() Theme
- func (u *UI) Tree(root string, nodes []TreeNode) *UI
- func (u *UI) TreeWithFiles(rootPath string, nodes []TreeNode) *UI
- func (u *UI) WarnLine(msg string) *UI
- func (u *UI) Welcome(name, description, version, date, banner string)
- type Viewer
Constants ¶
View Source
const ( QRLevelL = qr.L // ~7% redundancy QRLevelM = qr.M // ~15% redundancy (default) QRLevelH = qr.H // ~30% redundancy )
Constants re-exported so callers can specify ECC level without importing rsc.io/qr.
View Source
const ( KB = 1024 MB = 1024 * 1024 )
Variables ¶
View Source
var DefaultIconSet = IconSet{
Success: "✓",
Warning: "⚠",
Error: "✗",
Info: "ℹ",
Arrow: "→",
Bullet: "•",
Checkbox: "☐",
CheckboxChecked: "☒",
Folder: "📁",
File: "📄",
Key: "🔑",
Lock: "🔒",
Dot: "●",
Dash: "─",
Pipe: "│",
}
View Source
var DefaultTheme = Theme{ Primary: compat.AdaptiveColor{Dark: lipgloss.Color("#c9d8e8"), Light: lipgloss.Color("#1e293b")}, Secondary: compat.AdaptiveColor{Dark: lipgloss.Color("#5a7490"), Light: lipgloss.Color("#64748b")}, Faint: compat.AdaptiveColor{Dark: lipgloss.Color("#3d5068"), Light: lipgloss.Color("#94a3b8")}, Accent: compat.AdaptiveColor{Dark: lipgloss.Color("#3b82f6"), Light: lipgloss.Color("#2563eb")}, Success: compat.AdaptiveColor{Dark: lipgloss.Color("#22c55e"), Light: lipgloss.Color("#16a34a")}, Warn: compat.AdaptiveColor{Dark: lipgloss.Color("#eab308"), Light: lipgloss.Color("#ca8a04")}, Danger: compat.AdaptiveColor{Dark: lipgloss.Color("#ef4444"), Light: lipgloss.Color("#dc2626")}, Value: compat.AdaptiveColor{Dark: lipgloss.Color("#e8f2ff"), Light: lipgloss.Color("#0f172a")}, Border: compat.AdaptiveColor{Dark: lipgloss.Color("#1a2232"), Light: lipgloss.Color("#dde4ed")}, }
Functions ¶
Types ¶
type DialogStyle ¶ added in v0.1.0
type DialogStyle int
const ( DialogDanger DialogStyle = iota DialogWarning DialogInfo DialogSuccess )
type HelpSection ¶
type InputConfig ¶ added in v0.1.0
type Option ¶
type Option func(*UI)
func WithIndent ¶
func WithReader ¶ added in v0.1.0
func WithWriter ¶
type QR ¶ added in v0.1.0
type QR struct {
// contains filtered or unexported fields
}
QR represents an encoded QR code ready for format generation.
type QRResult ¶ added in v0.1.0
type QRResult struct {
// Terminal is compact UTF-8 half-block art — fallback if image protocols fail.
Terminal string
// SVG is a self-contained <svg> element (no DOCTYPE / namespace).
SVG string
// PNG is raw PNG bytes — pass directly to go-termimg for rendering.
PNG []byte
}
QRResult holds all representations of a generated QR code.
type RegistrationResult ¶ added in v0.1.0
type Theme ¶
type Theme struct {
Primary compat.AdaptiveColor
Secondary compat.AdaptiveColor
Faint compat.AdaptiveColor
Accent compat.AdaptiveColor
Success compat.AdaptiveColor
Warn compat.AdaptiveColor
Danger compat.AdaptiveColor
Value compat.AdaptiveColor
Border compat.AdaptiveColor
}
type UI ¶
type UI struct {
// contains filtered or unexported fields
}
func (*UI) BackupStart ¶
func (*UI) ConfirmDefault ¶ added in v0.1.0
func (*UI) FlushAfter ¶ added in v0.1.0
func (u *UI) FlushAfter(fn func())
FlushAfter is an alias for Render kept for backward compatibility.
func (*UI) HelpScreen ¶
func (u *UI) HelpScreen(sections []HelpSection) *UI
func (*UI) InitSuccess ¶
func (*UI) KeyValueLink ¶
func (*UI) LinkInline ¶
func (*UI) PasswordConfirm ¶ added in v0.1.0
func (*UI) PasswordConfirmRequired ¶ added in v0.1.0
func (*UI) PasswordConfirmWithHint ¶ added in v0.1.0
func (*UI) PasswordMinLength ¶ added in v0.1.0
func (*UI) PasswordRequired ¶ added in v0.1.0
func (*UI) PasswordRequiredWithHint ¶ added in v0.1.0
func (*UI) PasswordWithHint ¶ added in v0.1.0
func (*UI) PromptInline ¶ added in v0.1.0
func (*UI) RegistrationForm ¶ added in v0.1.0
func (u *UI) RegistrationForm(title, description string) (*RegistrationResult, error)
func (*UI) RestoreDone ¶
func (*UI) SectionHeader ¶
func (*UI) ServiceStatus ¶
func (*UI) SimpleUserPass ¶ added in v0.1.0
func (*UI) StatusBadge ¶
func (*UI) StepWithLink ¶
func (*UI) SuccessLine ¶
func (*UI) TableWithLinks ¶
type Viewer ¶
type Viewer struct {
// contains filtered or unexported fields
}
Viewer renders directory contents using the ui theme. Two modes:
horizontal=true — compact grid (used when dropping into a shell) horizontal=false — lipgloss/tree with one level of expansion
func NewViewerWithUI ¶
NewViewerWithUI creates a Viewer using an existing UI instance.
Click to show internal directories.
Click to hide internal directories.