ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 12 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.

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 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