Documentation
¶
Index ¶
- Variables
- func MaxLineWidth(content string) int
- func SafeWidth(terminalWidth int, content string) int
- func SafeWidthForEmojis(terminalWidth int, emojiCount int) int
- func TerminalWidth(s string) int
- type App
- type AppOptions
- type ErrorMsg
- type FocusedPanel
- type InitialProjectErrorMsg
- type InitialProjectLoadedMsg
- type KeyMap
- type LoadingMsg
- type ProjectSelectedMsg
- type ProjectsLoadedMsg
- type RefreshMsg
- type Styles
- type TextInputFocusable
- type ViewType
Constants ¶
This section is empty.
Variables ¶
var ( ColorPrimary = lipgloss.Color("#4285F4") // Google Blue ColorSecondary = lipgloss.Color("#34A853") // Google Green ColorWarning = lipgloss.Color("#FBBC05") // Google Yellow ColorError = lipgloss.Color("#EA4335") // Google Red ColorMuted = lipgloss.Color("#9AA0A6") // Gray ColorBg = lipgloss.Color("#202124") // Dark background ColorBgLight = lipgloss.Color("#303134") // Lighter background )
Color palette - GCP inspired colors
Functions ¶
func MaxLineWidth ¶
MaxLineWidth finds the maximum terminal width among all lines in content.
func SafeWidth ¶
SafeWidth returns the maximum width that can be used for content to avoid line wrapping due to emoji width miscalculation. Pass the terminal width and the string that will be rendered.
lipgloss.Place() pads ALL lines to the target width. So if any line has emojis that terminals render wider than lipgloss measures, those lines will overflow. We must reduce width by the max emoji count on any line to ensure the worst-case line still fits.
func SafeWidthForEmojis ¶
SafeWidthForEmojis returns the terminal width reduced by the expected number of emojis that will appear on a line. Use this when you know how many emojis will be rendered but don't have the final string yet.
func TerminalWidth ¶
TerminalWidth calculates the actual terminal width of a string, accounting for emoji characters that lipgloss.Width() miscounts.
lipgloss.Width() counts most emojis as 1 character, but native terminals (Kitty, Alacritty, macOS Terminal) render them as 2 characters wide. This function adds 1 for each emoji to get the true terminal width.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the main application model
func NewApp ¶
func NewApp(client *gcp.Client, opts AppOptions) *App
NewApp creates a new application instance
func (*App) GetContext ¶
func (a *App) GetContext() *context.ProgramContext
GetContext returns the shared program context. Views can use this to access dimensions, styles, and task tracking.
func (*App) ShowProjectSelectorOnStartup ¶
func (a *App) ShowProjectSelectorOnStartup()
ShowProjectSelectorOnStartup configures the app to show project selector on startup
type AppOptions ¶
type AppOptions struct {
// InitialProjectID skips project selector and goes directly to this project
InitialProjectID string
}
AppOptions configures the application
type ErrorMsg ¶
type ErrorMsg struct {
Err error
Context string // Additional context about where the error occurred
}
ErrorMsg is sent when an error occurs
type FocusedPanel ¶
type FocusedPanel int
FocusedPanel indicates which panel has keyboard focus
const ( FocusContent FocusedPanel = iota FocusSidebar )
type InitialProjectErrorMsg ¶
type InitialProjectErrorMsg struct {
Err error
ProjectID string // The project ID that failed to load
}
InitialProjectErrorMsg is sent when loading initial project fails
type InitialProjectLoadedMsg ¶
InitialProjectLoadedMsg is sent when the initial project (from config/flag) is loaded
type KeyMap ¶
type KeyMap struct {
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
Select key.Binding
Back key.Binding
Quit key.Binding
Help key.Binding
Refresh key.Binding
Search key.Binding
Tab key.Binding
ShiftTab key.Binding
SelectSidebar key.Binding // '[' - focus sidebar
SelectContent key.Binding // ']' - focus content
ToggleSidebar key.Binding // '{' - show/hide sidebar
ActionMenu key.Binding
CommandPalette key.Binding
}
KeyMap defines all application key bindings
type LoadingMsg ¶
LoadingMsg indicates a loading state change
type ProjectSelectedMsg ¶
ProjectSelectedMsg is sent when a project is selected
type ProjectsLoadedMsg ¶
ProjectsLoadedMsg is sent when projects are fetched from GCP
type Styles ¶
type Styles struct {
App lipgloss.Style
Title lipgloss.Style
Subtitle lipgloss.Style
Selected lipgloss.Style
Hover lipgloss.Style // Mouse hover state
Normal lipgloss.Style
Muted lipgloss.Style
Error lipgloss.Style
Success lipgloss.Style
Warning lipgloss.Style
Help lipgloss.Style
StatusBar lipgloss.Style
ListItem lipgloss.Style
ActiveBorder lipgloss.Style
}
Styles holds all application styles
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles returns the default application styles
type TextInputFocusable ¶
type TextInputFocusable interface {
HasTextInputFocused() bool
}
TextInputFocusable is implemented by views that can have text input fields focused
type ViewType ¶
type ViewType int
ViewType represents different screens in the application
const ( ViewNone ViewType = -1 // Sentinel value for unset/invalid view ViewProjects ViewType = iota ViewInstances ViewInstanceDetails ViewMetadata ViewProjectMetadata ViewDisks ViewDiskDetails ViewSnapshots ViewSnapshotDetails ViewImages ViewImageDetails ViewBuckets ViewObjects // Browsing objects within a bucket ViewObjectDetails // Viewing object details ViewInstanceEditor // Editing instance properties (labels, etc.) ViewBucketCreate // Creating a new GCS bucket ViewSnapshotCreate // Creating a snapshot from a disk ViewImageCreate // Creating an image from a disk ViewDiskCreate // Creating a disk from a snapshot ViewNetworks ViewNetworkDetails ViewFirewall ViewFirewallDetails ViewSubnets ViewSubnetDetails ViewSubnetCreate ViewRoutes ViewRouteDetails ViewRouteCreate ViewSQLInstances ViewSQLInstanceDetails ViewServiceAccounts ViewServiceAccountDetails ViewServiceAccountCreate ViewIAMPolicy ViewCustomRoles ViewCustomRoleDetails ViewCloudRunServices ViewCloudRunServiceDetails ViewCloudRunServiceEdit ViewInstanceCreate // Creating a new VM instance ViewInstanceConfigEdit // Editing an existing VM instance configuration ViewLogs ViewFormDemo // Demo view for testing form components )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
actionmenu
Package actionmenu provides a popup action menu component for views.
|
Package actionmenu provides a popup action menu component for views. |
|
confirm
Package confirm provides confirmation dialogs for destructive actions.
|
Package confirm provides confirmation dialogs for destructive actions. |
|
diff
Package diff provides a component for displaying before/after comparisons with confirmation dialog for changes.
|
Package diff provides a component for displaying before/after comparisons with confirmation dialog for changes. |
|
footer
Package footer provides an enhanced footer component with dynamic content.
|
Package footer provides an enhanced footer component with dynamic content. |
|
forms
Package forms provides reusable form components for editing GCP resources.
|
Package forms provides reusable form components for editing GCP resources. |
|
inputdialog
Package inputdialog provides a simple modal input dialog for capturing text input.
|
Package inputdialog provides a simple modal input dialog for capturing text input. |
|
labeledit
Package labeledit provides a component for editing key-value label pairs used in GCP resources like VM instances.
|
Package labeledit provides a component for editing key-value label pairs used in GCP resources like VM instances. |
|
links
Package links provides a component for navigable links within detail views.
|
Package links provides a component for navigable links within detail views. |
|
sortmenu
Package sortmenu provides a popup sort column selector for table views.
|
Package sortmenu provides a popup sort column selector for table views. |
|
table
Package table provides a reusable table component with GCP styling and filtering support.
|
Package table provides a reusable table component with GCP styling and filtering support. |
|
tabs
Package tabs provides a reusable tab bar component for detail views.
|
Package tabs provides a reusable tab bar component for detail views. |
|
textarea
Package textarea provides a multi-line text editor with GCP styling.
|
Package textarea provides a multi-line text editor with GCP styling. |
|
timer
Package timer provides countdown and elapsed time components with GCP styling.
|
Package timer provides countdown and elapsed time components with GCP styling. |
|
viewport
Package viewport provides a scrollable content container with GCP styling.
|
Package viewport provides a scrollable content container with GCP styling. |
|
Package context provides shared state that propagates to all views and components.
|
Package context provides shared state that propagates to all views and components. |
|
Package focus provides a unified focus management system for views with multiple interactive regions (tabs, links, viewport, etc.).
|
Package focus provides a unified focus management system for views with multiple interactive regions (tabs, links, viewport, etc.). |
|
Package layout provides tile-based layout management using teatile.
|
Package layout provides tile-based layout management using teatile. |
|
Package symbols provides centralized UI symbols with multiple display modes.
|
Package symbols provides centralized UI symbols with multiple display modes. |
|
Package timeutil provides time formatting helpers that respect local timezone.
|
Package timeutil provides time formatting helpers that respect local timezone. |
|
Package views implements the view layer for the gcon TUI.
|
Package views implements the view layer for the gcon TUI. |