Documentation
¶
Overview ¶
Package tui provides the terminal user interface for GitHubby
Index ¶
- Constants
- Variables
- func ChangeScreen(screen Screen) tea.Cmd
- func ClearMessageCmd(delay time.Duration) tea.Cmd
- func ErrorCmd(err error) tea.Cmd
- func ExitTimeoutCmd(timeout time.Duration) tea.Cmd
- func PopScreenCmd() tea.Cmd
- func PrintNonInteractiveHelp()
- func PushScreenCmd(screen Screen) tea.Cmd
- func QuitCmd() tea.Cmd
- func RefreshDashboardCmd() tea.Cmd
- func Run(ctx context.Context, startScreen Screen, isAuthenticated bool, username string) error
- func RunApp(ctx context.Context, opts ...AppOption) error
- func RunAppInstance(ctx context.Context, app *App) error
- func RunDashboard(ctx context.Context, username string) error
- func RunOnboarding(ctx context.Context) error
- type App
- func (a *App) Context() context.Context
- func (a *App) DeleteProfileInfo() (string, string)
- func (a *App) GitHubClient() github.Client
- func (a *App) Height() int
- func (a *App) Init() tea.Cmd
- func (a *App) IsAuthenticated() bool
- func (a *App) PopScreen() tea.Cmd
- func (a *App) ProfilesToSync() []*state.SyncProfile
- func (a *App) PushScreen(screen Screen) tea.Cmd
- func (a *App) RegisterScreen(screen Screen, model ScreenModel)
- func (a *App) RegisterScreenFactory(screen Screen, factory ScreenFactory)
- func (a *App) ResetToScreen(screen Screen) tea.Cmd
- func (a *App) SelectedProfile() *state.SyncProfile
- func (a *App) SetProfilesToSync(profiles []*state.SyncProfile)
- func (a *App) SetScreen(screen Screen) tea.Cmd
- func (a *App) SetSelectedProfile(profile *state.SyncProfile)
- func (a *App) Storage() *state.Storage
- func (a *App) Styles() *Styles
- func (a *App) Token() string
- func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (a *App) Username() string
- func (a *App) View() string
- func (a *App) Width() int
- type AppOption
- type AuthCompleteMsg
- type AuthRequiredMsg
- type ClearMessageMsg
- type DeleteProfileCancelledMsg
- type DeleteProfileConfirmedMsg
- type DeleteProfileRequestMsg
- type DeleteProgressMsg
- type ErrorMsg
- type ExitTimeoutMsg
- type KeyMap
- type NewSyncRequestedMsg
- type OrgsLoadedMsg
- type ProfileSavedMsg
- type ProfileSelectedMsg
- type QuickSyncRequestedMsg
- type QuitMsg
- type RefreshDashboardMsg
- type ReleasesLoadedMsg
- type ReposLoadedMsg
- type Screen
- type ScreenChangeMsg
- type ScreenFactory
- type ScreenModel
- type ScreenPopMsg
- type ScreenPushMsg
- type Styles
- type SyncAllProfilesMsg
- type SyncCompleteMsg
- type SyncPendingProfilesMsg
- type SyncProgressMsg
- type UpdateAvailableMsg
- type UpdateCompleteMsg
- type UpdateErrorMsg
Constants ¶
const ( // ExitConfirmTimeout is the duration before exit confirmation expires ExitConfirmTimeout = 2 * time.Second // MessageDisplayDuration is how long temporary messages are shown MessageDisplayDuration = 3 * time.Second )
Variables ¶
var ( // Primary colors ColorPrimary = lipgloss.AdaptiveColor{Light: "#7C3AED", Dark: "#A78BFA"} // Purple ColorSecondary = lipgloss.AdaptiveColor{Light: "#059669", Dark: "#34D399"} // Green ColorAccent = lipgloss.AdaptiveColor{Light: "#0284C7", Dark: "#38BDF8"} // Blue // Status colors ColorSuccess = lipgloss.AdaptiveColor{Light: "#16A34A", Dark: "#4ADE80"} ColorWarning = lipgloss.AdaptiveColor{Light: "#CA8A04", Dark: "#FACC15"} ColorError = lipgloss.AdaptiveColor{Light: "#DC2626", Dark: "#F87171"} ColorInfo = lipgloss.AdaptiveColor{Light: "#0284C7", Dark: "#38BDF8"} // Neutral colors ColorMuted = lipgloss.AdaptiveColor{Light: "#6B7280", Dark: "#9CA3AF"} ColorSubtle = lipgloss.AdaptiveColor{Light: "#9CA3AF", Dark: "#6B7280"} ColorBorder = lipgloss.AdaptiveColor{Light: "#E5E7EB", Dark: "#374151"} ColorSelected = lipgloss.AdaptiveColor{Light: "#F3F4F6", Dark: "#1F2937"} )
Color palette
Functions ¶
func ChangeScreen ¶
ChangeScreen returns a command to change to a screen
func ClearMessageCmd ¶
ClearMessageCmd returns a command to clear message after delay
func ExitTimeoutCmd ¶
ExitTimeoutCmd returns a command for exit confirmation timeout
func PopScreenCmd ¶
PopScreenCmd returns a command to pop the screen stack
func PrintNonInteractiveHelp ¶
func PrintNonInteractiveHelp()
PrintNonInteractiveHelp prints help when not in an interactive terminal
func PushScreenCmd ¶
PushScreenCmd returns a command to push a screen
func RefreshDashboardCmd ¶
RefreshDashboardCmd returns a command to refresh dashboard
func RunAppInstance ¶
RunAppInstance runs an existing App instance
func RunDashboard ¶
RunDashboard starts the TUI in dashboard mode (legacy)
func RunOnboarding ¶
RunOnboarding starts the TUI in onboarding mode (legacy)
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the main TUI application model
func (*App) DeleteProfileInfo ¶
DeleteProfileInfo returns the profile ID and name for deletion confirmation
func (*App) GitHubClient ¶
GitHubClient returns the GitHub client
func (*App) IsAuthenticated ¶
IsAuthenticated returns whether the user is authenticated
func (*App) ProfilesToSync ¶
func (a *App) ProfilesToSync() []*state.SyncProfile
ProfilesToSync returns the list of profiles to sync (for batch sync)
func (*App) PushScreen ¶
PushScreen pushes current screen to stack and sets new screen
func (*App) RegisterScreen ¶
func (a *App) RegisterScreen(screen Screen, model ScreenModel)
RegisterScreen registers a pre-created screen model
func (*App) RegisterScreenFactory ¶
func (a *App) RegisterScreenFactory(screen Screen, factory ScreenFactory)
RegisterScreenFactory registers a factory function for lazy screen creation
func (*App) ResetToScreen ¶
ResetToScreen clears the stack and sets a new screen
func (*App) SelectedProfile ¶
func (a *App) SelectedProfile() *state.SyncProfile
SelectedProfile returns the currently selected profile for quick sync
func (*App) SetProfilesToSync ¶
func (a *App) SetProfilesToSync(profiles []*state.SyncProfile)
SetProfilesToSync sets the list of profiles for batch sync
func (*App) SetSelectedProfile ¶
func (a *App) SetSelectedProfile(profile *state.SyncProfile)
SetSelectedProfile sets the selected profile for quick sync
type AppOption ¶
type AppOption func(*App)
AppOption configures the App
func WithContext ¶
WithContext sets the context for the App
func WithGitHubClient ¶
WithGitHubClient sets the GitHub client
func WithStorage ¶
WithStorage sets the state storage
func WithVersion ¶
WithVersion sets the app version info for display
type AuthCompleteMsg ¶
AuthCompleteMsg signals authentication completed
type AuthRequiredMsg ¶
type AuthRequiredMsg struct{}
AuthRequiredMsg signals authentication is required
type ClearMessageMsg ¶
type ClearMessageMsg struct{}
ClearMessageMsg signals a temporary message should be cleared
type DeleteProfileCancelledMsg ¶
type DeleteProfileCancelledMsg struct{}
DeleteProfileCancelledMsg signals user cancelled profile deletion
type DeleteProfileConfirmedMsg ¶
DeleteProfileConfirmedMsg signals user confirmed profile deletion
type DeleteProfileRequestMsg ¶
DeleteProfileRequestMsg signals user wants to delete a profile (shows confirmation)
type DeleteProgressMsg ¶
DeleteProgressMsg signals progress during release deletion
type ExitTimeoutMsg ¶
type ExitTimeoutMsg struct{}
ExitTimeoutMsg signals exit confirmation timeout expired
type KeyMap ¶
type KeyMap struct {
// Navigation
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
Home key.Binding
End key.Binding
PageUp key.Binding
PageDown key.Binding
// Selection
Select key.Binding
SelectAll key.Binding
SelectNone key.Binding
Toggle key.Binding
// Actions
Confirm key.Binding
Cancel key.Binding
Back key.Binding
Help key.Binding
Quit key.Binding
Refresh key.Binding
// Search/Filter
Filter key.Binding
Search key.Binding
Clear key.Binding
// Tabs/Screens
Tab key.Binding
ShiftTab key.Binding
NextTab key.Binding
PrevTab key.Binding
}
KeyMap defines the key bindings for the TUI
type NewSyncRequestedMsg ¶
type NewSyncRequestedMsg struct{}
NewSyncRequestedMsg signals user wants to start a new sync
type OrgsLoadedMsg ¶
type OrgsLoadedMsg struct {
Orgs []*gh.Organization
Error error
}
OrgsLoadedMsg signals organizations have been fetched
type ProfileSavedMsg ¶
type ProfileSavedMsg struct {
Profile *state.SyncProfile
Error error
}
ProfileSavedMsg signals a profile was saved
type ProfileSelectedMsg ¶
type ProfileSelectedMsg struct {
Profile *state.SyncProfile
}
ProfileSelectedMsg signals a profile was selected
type QuickSyncRequestedMsg ¶
type QuickSyncRequestedMsg struct {
ProfileID string
}
QuickSyncRequestedMsg signals user wants to quick sync a profile
type RefreshDashboardMsg ¶
type RefreshDashboardMsg struct{}
RefreshDashboardMsg signals dashboard should refresh data
type ReleasesLoadedMsg ¶
type ReleasesLoadedMsg struct {
Releases []*gh.RepositoryRelease
Error error
}
ReleasesLoadedMsg signals releases have been fetched
type ReposLoadedMsg ¶
type ReposLoadedMsg struct {
Repos []*gh.Repository
Error error
}
ReposLoadedMsg signals repositories have been fetched
type ScreenChangeMsg ¶
type ScreenChangeMsg struct {
Screen Screen
}
ScreenChangeMsg signals a direct screen change
type ScreenFactory ¶
type ScreenFactory func(ctx context.Context, app *App) ScreenModel
ScreenFactory creates a screen with dependencies
type ScreenModel ¶
type ScreenModel interface {
tea.Model
// Title returns the screen title for the header
Title() string
// ShortHelp returns key bindings for the footer help
ShortHelp() []key.Binding
}
ScreenModel is the interface that all screens must implement
type ScreenPopMsg ¶
type ScreenPopMsg struct{}
ScreenPopMsg signals a screen pop (return to previous)
type ScreenPushMsg ¶
type ScreenPushMsg struct {
Screen Screen
}
ScreenPushMsg signals a screen push (saves current to stack)
type Styles ¶
type Styles struct {
// App-level styles
App lipgloss.Style
Content lipgloss.Style
// Header styles
Header lipgloss.Style
HeaderTitle lipgloss.Style
HeaderStatus lipgloss.Style
// Footer styles
HelpKey lipgloss.Style
HelpValue lipgloss.Style
// Menu styles
MenuItem lipgloss.Style
MenuItemSelected lipgloss.Style
MenuItemDisabled lipgloss.Style
// List styles
ListTitle lipgloss.Style
ListItem lipgloss.Style
ListItemDesc lipgloss.Style
ListSelected lipgloss.Style
ListPaginator lipgloss.Style
// Form styles
FormTitle lipgloss.Style
FormDescription lipgloss.Style
FormInput lipgloss.Style
FormPlaceholder lipgloss.Style
// Progress styles
ProgressBar lipgloss.Style
ProgressLabel lipgloss.Style
ProgressPercent lipgloss.Style
ProgressComplete lipgloss.Style
// Status styles
Success lipgloss.Style
Warning lipgloss.Style
Error lipgloss.Style
Info lipgloss.Style
Muted lipgloss.Style
// Box styles
Box lipgloss.Style
BoxTitle lipgloss.Style
BoxHighlighted lipgloss.Style
// Badge styles
Badge lipgloss.Style
BadgePrivate lipgloss.Style
BadgePublic lipgloss.Style
// Spinner
Spinner lipgloss.Style
}
Styles contains all the TUI styles
func DefaultStyles ¶
func DefaultStyles() *Styles
DefaultStyles returns the default style configuration
type SyncAllProfilesMsg ¶
type SyncAllProfilesMsg struct{}
SyncAllProfilesMsg signals user wants to sync all profiles
type SyncCompleteMsg ¶
type SyncCompleteMsg struct {
Result *sync.Result
Record *state.SyncRecord
Error error
}
SyncCompleteMsg signals sync completed
type SyncPendingProfilesMsg ¶
type SyncPendingProfilesMsg struct{}
SyncPendingProfilesMsg signals user wants to sync pending profiles
type SyncProgressMsg ¶
type SyncProgressMsg struct {
RepoName string
Status sync.ProgressStatus
Message string
Current int
Total int
}
SyncProgressMsg signals progress during sync
type UpdateAvailableMsg ¶ added in v1.0.1
UpdateAvailableMsg signals that an update is available
type UpdateCompleteMsg ¶ added in v1.0.3
UpdateCompleteMsg signals that an update has completed
type UpdateErrorMsg ¶ added in v1.0.3
type UpdateErrorMsg struct {
Error error
}
UpdateErrorMsg signals that an update failed
Directories
¶
| Path | Synopsis |
|---|---|
|
Package components provides reusable TUI components
|
Package components provides reusable TUI components |
|
Package screens provides TUI screen implementations
|
Package screens provides TUI screen implementations |
|
Package util provides utility functions for the TUI
|
Package util provides utility functions for the TUI |