Documentation
¶
Overview ¶
Package ui provides terminal UI components for the saws CLI.
Index ¶
- Variables
- func Banner() string
- func Confirm(message string) (bool, error)
- func FormatKeyValue(key, value string) string
- func GenerateUniqueProfileNames(profiles []profile.SSOProfile) []string
- func InitStyles()
- func SuggestProfileName(accountName, roleName string) string
- type DiscoveredProfile
- type SSOConnection
- type SelectionResult
Constants ¶
This section is empty.
Variables ¶
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 )
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 FormatKeyValue ¶
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 ¶
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 ¶
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.