Documentation
¶
Overview ¶
Package ui owns terminal styling and shared interactive helpers.
The Python tool uses raw ANSI escape codes via a tiny Colors helper. We use lipgloss for the same effect but with adaptive colour, automatic NO_COLOR support, and proper width calculations for two-column layouts.
Index ¶
- Variables
- func Errorf(msg string) string
- func Iconf(style lipgloss.Style, glyph, msg string) string
- func Infof(msg string) string
- func LoadVault() (*store.Saved, error)
- func PromptNewPassword(title string) (string, error)
- func PromptPassword(prompt string) (string, error)
- func RenderServerTable(servers []store.Server) string
- func Successf(msg string) string
- func TerminalWidth() int
- func Warnf(msg string) string
Constants ¶
This section is empty.
Variables ¶
var ( Title = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12")) Heading = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("14")) Subtle = lipgloss.NewStyle().Foreground(lipgloss.Color("8")) Success = lipgloss.NewStyle().Foreground(lipgloss.Color("10")) Warn = lipgloss.NewStyle().Foreground(lipgloss.Color("11")) ErrorSty = lipgloss.NewStyle().Foreground(lipgloss.Color("9")).Bold(true) Accent = lipgloss.NewStyle().Foreground(lipgloss.Color("13")) Favorite = lipgloss.NewStyle().Foreground(lipgloss.Color("11")) Muted = lipgloss.NewStyle().Foreground(lipgloss.Color("244")) )
Functions ¶
func LoadVault ¶
LoadVault is the canonical entry point for every command that touches the encrypted store. It tries (in order):
- an active session (no prompt)
- interactive password prompt
- first-time setup if no vault exists yet
On success, callers receive a *store.Saved they can mutate and re-save. The session is refreshed on every successful unlock.
func PromptNewPassword ¶
PromptNewPassword runs the same two-field flow as first-time setup. Used by `vault change-password`.
func PromptPassword ¶
PromptPassword does a one-shot password read (no confirmation). Used for legacy import where we need the OLD vault password.
func RenderServerTable ¶
RenderServerTable produces a sorted, numbered, lipgloss-styled table of servers. Auto-switches to two-column layout on terminals >= 140 columns, matching the Python tool's behaviour.
func TerminalWidth ¶
func TerminalWidth() int
TerminalWidth returns the current terminal width, defaulting to 100 when stdout isn't a TTY (so piped output still wraps reasonably).
Types ¶
This section is empty.