Documentation
¶
Overview ¶
Package tui implements the Bubbletea TUI for Snappy.
Index ¶
- type FlashTickMsg
- type LaunchdController
- func (LaunchdController) Install(cfg service.PlistConfig) error
- func (LaunchdController) ResolveBinaryPath() (string, error)
- func (LaunchdController) Start(label string) error
- func (LaunchdController) Status(label string) (*service.Info, error)
- func (LaunchdController) Stop(label string) error
- func (LaunchdController) Uninstall(label string) error
- type Model
- type ModelParams
- type OpenLogDirResultMsg
- type RefreshResultMsg
- type RefreshTickMsg
- type ServiceController
- type ServiceInstallResultMsg
- type ServiceStatusResultMsg
- type ServiceToggleResultMsg
- type ServiceUninstallResultMsg
- type SnapshotCreatedMsg
- type ThinResultMsg
- type UITickMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlashTickMsg ¶ added in v0.8.0
type FlashTickMsg struct {
ID uint64
}
FlashTickMsg advances the border flash animation by one frame.
type LaunchdController ¶ added in v0.10.0
type LaunchdController struct{}
LaunchdController implements ServiceController using the real service package.
func (LaunchdController) Install ¶ added in v0.11.0
func (LaunchdController) Install(cfg service.PlistConfig) error
Install writes the plist and bootstraps the launchd agent.
func (LaunchdController) ResolveBinaryPath ¶ added in v0.11.0
func (LaunchdController) ResolveBinaryPath() (string, error)
ResolveBinaryPath returns the canonical path of the running executable.
func (LaunchdController) Start ¶ added in v0.10.0
func (LaunchdController) Start(label string) error
Start enables and starts the agent (kickstart), falling back to bootstrap if needed.
func (LaunchdController) Status ¶ added in v0.10.0
func (LaunchdController) Status(label string) (*service.Info, error)
Status queries launchctl for the current state of the agent.
func (LaunchdController) Stop ¶ added in v0.10.0
func (LaunchdController) Stop(label string) error
Stop disables and unloads the launchd agent via bootout.
func (LaunchdController) Uninstall ¶ added in v0.11.0
func (LaunchdController) Uninstall(label string) error
Uninstall stops and removes the launchd agent.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubbletea model for the Snappy TUI.
func NewModel ¶
func NewModel(cfg *config.Config, runner platform.CommandRunner, log *logger.Logger, params ModelParams) Model
NewModel creates a Model with the given dependencies. When DaemonActive is true, auto-snapshots are disabled because a background service holds the lock.
func (Model) Init ¶
Init returns the initial commands: a refresh, a tick timer, and a background color request. The UI tick is started when auto-snapshot is enabled or a daemon is active, since it drives the countdown timer and keeps snapshot ages fresh.
type ModelParams ¶ added in v0.8.0
type ModelParams struct {
APFSVolume string
APFSContainer string
TMStatus string
VolumeName string
Version string
Lock *service.LockFile // pre-acquired persistent lock, or nil
DaemonActive bool
ServiceCtrl ServiceController // nil disables service features
ServiceInstalled bool
ServiceRunning bool
ConfigFile string // resolved config file path for service plist
}
ModelParams groups the string and boolean parameters for NewModel, preventing accidental argument reordering at call sites.
type OpenLogDirResultMsg ¶ added in v0.7.0
type OpenLogDirResultMsg struct {
Err error
}
OpenLogDirResultMsg reports the result of attempting to open the log directory.
type RefreshResultMsg ¶
type RefreshResultMsg struct {
Snapshots []snapshot.Snapshot
TMStatus string
APFSInfo platform.APFSInfo
DiskInfo platform.DiskInfo
DiskErr bool
SnapshotErr error
APFSErr error
Tidemark int64
TidemarkErr error
}
RefreshResultMsg carries the result of a full data refresh.
type RefreshTickMsg ¶
type RefreshTickMsg struct{}
RefreshTickMsg signals that the periodic refresh timer has fired.
type ServiceController ¶ added in v0.10.0
type ServiceController interface {
Status(label string) (*service.Info, error)
Start(label string) error
Stop(label string) error
Install(cfg service.PlistConfig) error
Uninstall(label string) error
ResolveBinaryPath() (string, error)
}
ServiceController abstracts launchd service operations for testability.
type ServiceInstallResultMsg ¶ added in v0.11.0
type ServiceInstallResultMsg struct {
Err error
}
ServiceInstallResultMsg carries the result of a service install attempt.
type ServiceStatusResultMsg ¶ added in v0.10.0
ServiceStatusResultMsg carries the result of a service status probe.
type ServiceToggleResultMsg ¶ added in v0.10.0
ServiceToggleResultMsg carries the result of a service start or stop.
type ServiceUninstallResultMsg ¶ added in v0.11.0
type ServiceUninstallResultMsg struct {
Err error
}
ServiceUninstallResultMsg carries the result of a service uninstall attempt.
type SnapshotCreatedMsg ¶
SnapshotCreatedMsg signals that a snapshot creation attempt completed. Skipped is true when an auto-snapshot was skipped because another process already holds the lock.