ui

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package ui provides terminal UI components for the saws CLI.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ColorPrimary is the AWS orange brand color.
	ColorPrimary = lipgloss.Color("#FF9900")
	// ColorSecondary is the AWS dark blue brand color.
	ColorSecondary = lipgloss.Color("#232F3E")
	// ColorSuccess is used for success messages.
	ColorSuccess = lipgloss.Color("#04B575")
	// ColorError is used for error messages.
	ColorError = lipgloss.Color("#FF4444")
	// ColorWarning is used for warning messages.
	ColorWarning = lipgloss.Color("#FFBB33")
	// ColorMuted is used for secondary/dimmed text.
	ColorMuted = lipgloss.Color("#626262")
	// ColorWhite is used for primary text on dark backgrounds.
	ColorWhite = lipgloss.Color("#FAFAFA")

	// TitleStyle is the style for section titles.
	TitleStyle lipgloss.Style
	// SubtitleStyle is the style for subtitle text.
	SubtitleStyle lipgloss.Style
	// SuccessStyle is the style for success messages.
	SuccessStyle lipgloss.Style
	// ErrorStyle is the style for error messages.
	ErrorStyle lipgloss.Style
	// WarningStyle is the style for warning messages.
	WarningStyle lipgloss.Style
	// MutedStyle is the style for dimmed/secondary text.
	MutedStyle lipgloss.Style
	// BoxStyle is the style for bordered content boxes.
	BoxStyle lipgloss.Style
	// CredentialBoxStyle is the style for credential display boxes.
	CredentialBoxStyle lipgloss.Style
	// KeyStyle is the style for key labels in key-value displays.
	KeyStyle lipgloss.Style
	// ValueStyle is the style for values in key-value displays.
	ValueStyle lipgloss.Style
	// BannerStyle is the style for the ASCII art banner.
	BannerStyle lipgloss.Style
)
View Source
var Output io.Writer = os.Stdout

Output is the writer used for TUI rendering. Defaults to os.Stdout. Set to os.Stderr when running in --export mode so that stdout remains clean for shell eval.

Functions

func Banner() string

Banner returns the saws ASCII banner.

func Confirm

func Confirm(message string) (bool, error)

Confirm displays a yes/no confirmation prompt.

func FormatKeyValue

func FormatKeyValue(key, value string) string

FormatKeyValue renders a styled key-value pair.

func GenerateUniqueProfileNames

func GenerateUniqueProfileNames(profiles []profile.SSOProfile) []string

GenerateUniqueProfileNames generates unique profile names for a list of profiles. If two profiles would get the same name (e.g. same role across accounts with the same name), it appends a numeric suffix (-2, -3, etc.).

func InitStyles added in v0.0.2

func InitStyles()

InitStyles (re)initializes all lipgloss styles using the current default renderer. Call this after configuring the lipgloss renderer (e.g. after setting it to stderr in --export mode) and before any style is used.

func SuggestProfileName

func SuggestProfileName(accountName, roleName string) string

SuggestProfileName generates a profile name from account and role info. It lowercases and joins with a dash, e.g. "production-administratoraccess".

Types

type DiscoveredProfile

type DiscoveredProfile struct {
	Profile profile.SSOProfile
	Name    string // auto-generated unique profile name
}

DiscoveredProfile pairs a profile with its auto-generated name for the import selector.

func RunProfileImportSelector

func RunProfileImportSelector(discovered []DiscoveredProfile) ([]DiscoveredProfile, error)

RunProfileImportSelector displays a multi-select list showing all discovered account/role combinations. All are pre-selected by default. The user can toggle items with space, select/deselect all with a/n, and confirm with enter. Typing filters the list; arrow keys navigate simultaneously.

type SSOConnection

type SSOConnection struct {
	StartURL string
	Region   string
}

SSOConnection holds the minimal info needed to authenticate with AWS SSO.

func RunSSOConnectionForm

func RunSSOConnectionForm(defaults *SSOConnection) (*SSOConnection, error)

RunSSOConnectionForm displays a minimal form asking only for SSO Start URL and Region. This is used for first-time setup / auto-discovery where we authenticate first, then discover accounts and roles via the API.

type SelectionResult

type SelectionResult struct {
	Profile *profile.SSOProfile // non-nil if an existing profile was selected
	IsNew   bool                // true if user wants to create a new profile
}

SelectionResult holds the result of the profile selection.

func RunProfileSelector

func RunProfileSelector(profiles []profile.SSOProfile) (*SelectionResult, error)

RunProfileSelector displays a searchable list of profiles, grouped by AWS account. Selecting an account expands to show its roles. Typing filters the list; arrow keys navigate simultaneously.

Jump to

Keyboard shortcuts

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