tui

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Colors
	ColorSuccess = lipgloss.Color("2")
	ColorError   = lipgloss.Color("1")
	ColorWarn    = lipgloss.Color("3")
	ColorInfo    = lipgloss.Color("4")
	ColorMuted   = lipgloss.Color("8")
	ColorPrimary = lipgloss.Color("63") // Matches standard EnvCrypt color

	// Base Styles
	StyleSuccess = lipgloss.NewStyle().Foreground(ColorSuccess)
	StyleError   = lipgloss.NewStyle().Foreground(ColorError)
	StyleWarn    = lipgloss.NewStyle().Foreground(ColorWarn)
	StyleInfo    = lipgloss.NewStyle().Foreground(ColorInfo)
	StyleMuted   = lipgloss.NewStyle().Foreground(ColorMuted)
	StylePrimary = lipgloss.NewStyle().Foreground(ColorPrimary)

	// Icons
	IconCheck = StyleSuccess.Render("[✓]")
	IconCross = StyleError.Render("[x]")
	IconWarn  = StyleWarn.Render("[!]")
	IconInfo  = StyleInfo.Render(">")

	// Structural Styles
	HeaderStyle = lipgloss.NewStyle().Foreground(ColorMuted).Bold(true)

	BoxStyleWarn = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(ColorWarn).
					Padding(1).
					MarginTop(1)

	BoxStylePrimary = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(ColorPrimary).
					Padding(1).
					MarginTop(1)
)

Functions

func ConfirmDangerousAction

func ConfirmDangerousAction(prompt, expected string) bool

func ConfirmOverwrite

func ConfirmOverwrite(path string) bool

func Error

func Error(msg string, err error) error

func Info

func Info(msg string)

func IsInteractive added in v1.1.1

func IsInteractive() bool

func PadRight

func PadRight(s string, width int) string

func PrintEnvSummary

func PrintEnvSummary(env map[string]string)

func PrintServiceRoleDetail

func PrintServiceRoleDetail(role *config.ServiceRole)

func PrintServiceRolePermissions

func PrintServiceRolePermissions(perm *config.ServiceRolePermsResponse, repoPrincipal string)

func PrintServiceRoleSecret

func PrintServiceRoleSecret(keyPair *config.ServiceRoleKeyPair)

func PromptWithDefault

func PromptWithDefault(label, defaultVal string) string

PromptWithDefault shows a single-field form pre-filled with defaultVal. In non-interactive environments it returns defaultVal unchanged.

func RenderDiff

func RenderDiff(diff cryptoutils.DiffingResult, oldMap, newMap map[string]string, showSecrets bool)

func RunActionWithSpinner

func RunActionWithSpinner(title string, action func() error) error

RunActionWithSpinner runs action in the background while showing a spinner. In non-interactive environments the spinner is suppressed and the action runs directly.

func RunEnvPicker

func RunEnvPicker(projectName string) (string, error)

RunEnvPicker shows a picker for common environment names with an "Other..." option that falls through to a free-text prompt for custom values.

func RunForm

func RunForm(fields []FormField, prefills []string) ([]string, error)

RunForm runs a bubbletea multi-field form in interactive terminals. In non-interactive environments it returns an error directing the user to use flags.

func RunPicker

func RunPicker(title string, items []string) (string, error)

RunPicker presents a keyboard-navigable list in interactive terminals. In non-interactive environments it returns an error directing the user to use flags.

func RunProjectsTable

func RunProjectsTable(projects []config.Project) error

RunProjectsTable renders an interactive bubbletea table of projects. Falls back to plain-text output in non-interactive environments.

func RunServiceRolesTable

func RunServiceRolesTable(roles []config.ServiceRole) error

RunServiceRolesTable renders an interactive bubbletea table of service roles. Falls back to plain-text output in non-interactive environments.

func Spacer

func Spacer()

Replaces standard output functions

func StripANSI

func StripANSI(s string) string

func Success

func Success(msg string)

func Truncate

func Truncate(s string, max int) string

func VisibleLen

func VisibleLen(s string) int

func Warn

func Warn(msg string)

Types

type FormField

type FormField struct {
	Label    string
	Secret   bool
	Required bool
}

FormField defines a single input field in a form.

Jump to

Keyboard shortcuts

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