ui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Copyright © 2026 54L1M

Package ui holds the lipgloss styling, cobra help template, and the bubbletea components (snippet picker and variable form) used across snip.

Copyright © 2026 54L1M

Index

Constants

This section is empty.

Variables

View Source
var (
	Primary   = lipgloss.Color("#3b82f6")
	Blue      = lipgloss.Color("#00bfda")
	Gray      = lipgloss.Color("#8a8a8a")
	LightGray = lipgloss.Color("#c6c6c6")
	Orange    = lipgloss.Color("202")
	Yellow    = lipgloss.Color("226")
	Green     = lipgloss.Color("#22c55e")

	ErrorStyle   = lipgloss.NewStyle().Foreground(Orange)
	SuccessStyle = lipgloss.NewStyle().Foreground(Primary)
	WarningStyle = lipgloss.NewStyle().
					Border(lipgloss.DoubleBorder(), true).
					BorderForeground(Yellow).Padding(0, 1)

	// CommandBoxStyle frames the resolved command shown before execution.
	CommandBoxStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder(), true).
					BorderForeground(Primary).
					Foreground(Green).
					Padding(0, 1)

	// Table styles, mirrored from i2c.
	HeaderStyle  = lipgloss.NewStyle().Foreground(Primary).Bold(true)
	CellStyle    = lipgloss.NewStyle().Padding(0, 1)
	OddRowStyle  = CellStyle.Foreground(Gray)
	EvenRowStyle = CellStyle.Foreground(LightGray)
)

Functions

func ApplyCustomHelpTemplate

func ApplyCustomHelpTemplate(cmd *cobra.Command)

ApplyCustomHelpTemplate installs the styled help template on cmd.

func Confirm

func Confirm(prompt string) bool

Confirm prints a y/N prompt and returns true only on an affirmative answer.

func DisplayWelcomeScreen

func DisplayWelcomeScreen()

DisplayWelcomeScreen prints the snip banner: the wordmark with scissors beside it, a short description, and a hint, framed in a rounded box.

func RenderCommandBox

func RenderCommandBox(command string) string

RenderCommandBox returns the resolved command framed in a styled box. When the command is wider than the terminal it is wrapped inside the box, so the border isn't broken up by the terminal's own line wrapping.

func RunForm

func RunForm(vars []string, defaults map[string]string) (map[string]string, bool, error)

RunForm prompts for each variable with its default pre-filled and returns the collected values. The bool is false if the user canceled (esc/ctrl+c).

func RunMultiSelector added in v0.2.0

func RunMultiSelector(choices []string, title string) ([]string, bool, error)

RunMultiSelector shows a filterable checklist and returns the chosen values in the order they were given. The bool is false if the user quit without confirming (q/esc/ctrl+c).

func RunSelector

func RunSelector(choices []string, title string) (string, error)

RunSelector shows a filterable list and returns the chosen value. An empty string means the user quit without selecting.

Types

This section is empty.

Jump to

Keyboard shortcuts

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