cmds

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ContainerRefreshInterval = 5 * time.Second

ContainerRefreshInterval is how often the app re-polls `docker compose ps` in the background, so panel statuses stay current when containers change outside the app (another terminal, a restart policy, ...).

Variables

This section is empty.

Functions

func AddHealthcheck

func AddHealthcheck(fileName, serviceName string, template utils.HealthcheckTemplate, port string) tea.Cmd

AddHealthcheck applies template to serviceName in the compose file at fileName, the file AppModel has loaded.

func AddService

func AddService(fileName, serviceName, image string) tea.Cmd

AddService writes serviceName/image as a new, minimal two-line service into the compose file at fileName - the whole feature minus the network (docs/plans/image-search.md Phase 1). It lands as the smallest fragment that exists, on purpose: the inline editor opens on it next so the user adds ports, volumes and everything else in the same YAML they would have hand-written, rather than this modal growing a field for each of them (docs/DESIGN.md §Editing services).

fileName is supplied by AppModel, not typed by the user - the same split RunDockerActionMsg uses for the file the docker calls act on.

func AdoptUngrouped added in v0.5.0

func AdoptUngrouped(fileName string, services []string) tea.Cmd

AdoptUngrouped writes profiles: [ungrouped] onto every named service in fileName. This is the opt-in materialization of the derived ungrouped row: the caller has already shown the confirmation that spells out the docker compose up consequence.

func ApplyTheme

func ApplyTheme(name string) tea.Cmd

ApplyTheme sets the named theme as active and persists it. Returns the message for AppModel to handle; any config-write error is reported through ThemeAppliedMsg so the banner can show it.

func CancelInlineEdit

func CancelInlineEdit() tea.Cmd

CancelInlineEdit is the follow-up command for the discard-changes confirm modal; the panel exits edit mode when it receives the message.

func CheckDocker

func CheckDocker() tea.Cmd

CheckDocker runs the preflight off the update loop. It is under 100ms (see docs/plans/docker-preflight.md's Timings), which is why it is cheap enough to run both at startup and on every docker error.

func ClearPendingAction

func ClearPendingAction() tea.Cmd

ClearPendingAction returns a command that announces the pending action is done.

func CloseModal

func CloseModal(follow tea.Cmd) tea.Cmd

func CreateComposeFile

func CreateComposeFile(fileName string, serviceName string, image string) tea.Cmd

CreateComposeFile writes a brand-new compose file at fileName in the current working directory, optionally pre-seeded with one service. Empty serviceName/image means "create an empty services: mapping".

func CreateGroup

func CreateGroup(fileName string, name string, serviceNames []string) tea.Cmd

CreateGroup tags each of the given services with a new group name in fileName, the compose file AppModel has loaded.

func CycleRestartPolicy added in v0.5.0

func CycleRestartPolicy(fileName, serviceName, current string) tea.Cmd

CycleRestartPolicy advances serviceName from current to the next policy in utils.NextRestartPolicy's cycle, in the compose file at fileName.

func DeleteGroup

func DeleteGroup(fileName string, name string) tea.Cmd

DeleteGroup removes a group tag from every service that carries it in fileName, which is the compose file AppModel has loaded. Re-resolving it here would write to whichever file the current directory happens to offer, which stops being the loaded one the moment --file points elsewhere.

func DeleteService added in v0.5.0

func DeleteService(fileName string, serviceName string) tea.Cmd

DeleteService removes a service's entry from fileName, which is the compose file AppModel has loaded. Same split as DeleteGroup: re-resolving the file here would write to whichever one the current directory happens to offer, which stops being the loaded one the moment --file points elsewhere.

func EditGroup

func EditGroup(fileName string, groupName string, members []string) tea.Cmd

EditGroup reconciles groupName's membership in fileName, the compose file AppModel has loaded. Services in members that lack the tag get it added; services not in members that carry it get it removed.

func EditService

func EditService(fileName string, serviceName string) tea.Cmd

EditService writes the service's YAML to a scratch file, hands it to the user's editor, and splices whatever comes back into the compose file.

A failure at any point leaves the compose file exactly as it was. There is deliberately no retry loop: the error is reported, the app is in an ordinary state, and pressing the key again is the retry. Being unable to leave without first fixing your text is worse than losing it.

func GetBackups added in v0.4.0

func GetBackups(composeFile, envPath string) tea.Cmd

GetBackups reads the backup store for each live source that has a path and merges them newest-first into one list. A source whose slug folder does not exist (never written, or brand-new) simply contributes nothing, so a stack with no .env yet still lists its compose backups.

func GetComposeFileContents

func GetComposeFileContents(fileName string) tea.Cmd

GetComposeFileContents reads the compose file at fileName and returns its raw text. Called when the Files page becomes active and after any write through the app, so the viewport stays in sync with disk.

func GetConfig

func GetConfig(source utils.ComposeSource) tea.Cmd

GetConfig resolves the compose file for source and loads it. It re-resolves on every reload rather than remembering the winner, so a file created (or removed) while the app is running is picked up.

func GetContainerStats

func GetContainerStats(containers []apptypes.DockerContainer, background bool) tea.Cmd

GetContainerStats fetches docker stats and merges them into the given containers slice. Each container is matched by ID.

func GetDockerUsage

func GetDockerUsage(containers []apptypes.DockerContainer) tea.Cmd

GetDockerUsage runs `docker system df --format json` and `docker info --format '{{.MemTotal}}'` and returns a DockerUsageMsg. The containers slice is passed in so the command can sum the used memory (from MemUsage) without the caller having to do it.

func GetEnvFileContents

func GetEnvFileContents(envPath string) tea.Cmd

GetEnvFileContents reads and parses the .env file at the given path. It uses compose-go's dotenv parser to match compose semantics.

func GetRunningContainers

func GetRunningContainers(composeFile string) tea.Cmd

GetRunningContainers is the foreground refresh: on success it clears the error banner, on failure it sets it. composeFile scopes the query to the file the app has loaded.

func GetRunningContainersBackground

func GetRunningContainersBackground(composeFile string) tea.Cmd

GetRunningContainersBackground is the ticker-driven poll: it refreshes container state and surfaces new docker errors, but a success leaves an error banner from another source (e.g. a failed action) alone.

func ListComposeFiles

func ListComposeFiles(dir string) tea.Cmd

ListComposeFiles scans dir for YAML files. The Files page's picker opens off the back of this, so the scan runs as a command rather than inline in AppModel's update.

func OpenAboutModal

func OpenAboutModal() tea.Cmd

OpenAboutModal opens the About modal: the brand mark, version, license and repo link. It is a read-only overlay, like the help overlay.

func OpenAddServiceModal

func OpenAddServiceModal() tea.Cmd

OpenAddServiceModal opens the modal that collects a new service's name and image before handing off to the inline editor.

func OpenComposeFilePicker

func OpenComposeFilePicker() tea.Cmd

func OpenConfirmModal

func OpenConfirmModal(message string, follow tea.Cmd) tea.Cmd

OpenConfirmModal asks AppModel to show a yes/no confirmation dialog. Follow runs only if the user confirms.

func OpenCreateGroupModal

func OpenCreateGroupModal() tea.Cmd

func OpenDeleteGroupModal

func OpenDeleteGroupModal(groupName string) tea.Cmd

func OpenDeleteServiceModal added in v0.5.0

func OpenDeleteServiceModal(serviceName string) tea.Cmd

func OpenEditGroupModal

func OpenEditGroupModal(groupName string) tea.Cmd

func OpenEditor

func OpenEditor() tea.Cmd

OpenEditor asks AppModel to open the compose file for editing.

func OpenEnvModal added in v0.4.0

func OpenEnvModal() tea.Cmd

OpenEnvModal opens the env modal.

func OpenErrorModal

func OpenErrorModal(message string) tea.Cmd

OpenErrorModal returns a command that opens an error modal.

func OpenHealthcheckPicker

func OpenHealthcheckPicker(serviceName string) tea.Cmd

OpenHealthcheckPicker opens the picker for serviceName.

func OpenHelpModal

func OpenHelpModal() tea.Cmd

OpenHelpModal asks AppModel to open the help overlay. Going through a message (rather than AppModel opening it straight from the key) is the same path every other modal takes, and lets anything else - a future Help button - open it the same way.

func OpenLogsModal

func OpenLogsModal(target string, isGroup bool) tea.Cmd

func OpenRenameGroupModal

func OpenRenameGroupModal(groupName string) tea.Cmd

func OpenServiceEditor

func OpenServiceEditor(serviceName string) tea.Cmd

OpenServiceEditor asks AppModel to open serviceName for editing in $EDITOR.

func OpenThemePicker

func OpenThemePicker() tea.Cmd

OpenThemePicker opens the theme picker: the list of registered themes with live preview on cursor movement and persist-on-confirm.

func OpenUsageOverlay

func OpenUsageOverlay() tea.Cmd

OpenUsageOverlay opens the Usage overlay: disk and memory usage bars.

func RefreshContainersTick

func RefreshContainersTick() tea.Cmd

RefreshContainersTick fires once after ContainerRefreshInterval. AppModel re-issues it on every RefreshContainersTickMsg, which is what makes the poll recurring.

func ReleaseUngrouped added in v0.5.0

func ReleaseUngrouped(fileName string) tea.Cmd

ReleaseUngrouped strips the ungrouped profile from every service carrying it in fileName, returning those services to the derived (profile-less) state. It is the in-app reversal of AdoptUngrouped.

func RenameGroup

func RenameGroup(fileName string, groupName string, newName string) tea.Cmd

RenameGroup renames groupName to newName in fileName, the compose file AppModel has loaded. See utils.RenameGroupTag.

func RequestAddEnvVariable

func RequestAddEnvVariable(key, value string) tea.Cmd

RequestAddEnvVariable asks AppModel to add or update an env variable.

func RequestAddHealthcheck

func RequestAddHealthcheck(serviceName string, template utils.HealthcheckTemplate, port string) tea.Cmd

RequestAddHealthcheck asks AppModel to insert template into serviceName's compose entry. port is only meaningful for the generic template.

func RequestCreateGroup

func RequestCreateGroup(name string, serviceNames []string) tea.Cmd

RequestCreateGroup asks AppModel to tag serviceNames with the group name.

func RequestCycleRestartPolicy added in v0.5.0

func RequestCycleRestartPolicy(serviceName string) tea.Cmd

RequestCycleRestartPolicy asks AppModel to cycle serviceName's restart policy.

func RequestDeleteEnvVariable

func RequestDeleteEnvVariable(key string) tea.Cmd

RequestDeleteEnvVariable asks AppModel to delete an env variable.

func RequestDockerAction

func RequestDockerAction(action string, target string, isGroup bool) tea.Cmd

RequestDockerAction asks AppModel to run action against target. Returning a command (rather than the message) keeps it usable as a ConfirmModal's on-confirm command.

func RequestEditEnvVariable

func RequestEditEnvVariable(key, value string) tea.Cmd

RequestEditEnvVariable asks AppModel to update an env variable value.

func RequestEditGroup

func RequestEditGroup(groupName string, members []string) tea.Cmd

RequestEditGroup asks AppModel to reconcile groupName to exactly members.

func RequestInlineEdit

func RequestInlineEdit(serviceName string) tea.Cmd

RequestInlineEdit asks AppModel to prepare a service fragment for inline editing.

func RequestRenameGroup

func RequestRenameGroup(groupName string, newName string) tea.Cmd

RequestRenameGroup asks AppModel to rename groupName to newName.

func RequestRestoreBackup added in v0.4.0

func RequestRestoreBackup(source, name string) tea.Cmd

RequestRestoreBackup emits a restore request for the named backup.

func RequestSaveService

func RequestSaveService(serviceName string, fragment []byte) tea.Cmd

RequestSaveService asks AppModel to save an inline-edited service fragment.

func RequestToggleUngrouped added in v0.5.0

func RequestToggleUngrouped() tea.Cmd

RequestToggleUngrouped asks AppModel to open the confirm for the reserved ungrouped row's materialization toggle.

func RestoreBackup added in v0.4.0

func RestoreBackup(source, backupName, composeFile, envPath string) tea.Cmd

RestoreBackup writes the named .bak back over its live source file and returns a message. The source file is resolved from the Source tag: "compose" maps to the compose file, ".env" to the .env. The write routes through ReplaceFileAtomically, so the file being replaced is snapshotted first and the restore is itself undoable.

func RunDockerAction

func RunDockerAction(action string, target string, isGroup bool, composeFile string, members []string) tea.Cmd

RunDockerAction runs a docker compose action (start, stop, restart, pull, remove) against a single service or every service in a group, off the main Update loop. composeFile scopes it to the file the app has loaded. members is the group's member services, resolved by AppModel; it is ignored when isGroup is false.

func RunEditor

func RunEditor(path string) tea.Cmd

RunEditor suspends the TUI, gives the terminal to the user's editor, and resumes when it exits. Bubble Tea handles the handover: it releases the terminal, restores raw mode and the alternate screen afterwards, and delivers the callback's message through the normal update loop.

Nothing here inspects or writes the file. The user is editing the real compose file directly, exactly as they would outside the app, so there is nothing to validate and nothing to roll back - a broken save surfaces as an ordinary config-load error on the reload that follows.

func SaveEnvFile

func SaveEnvFile(envPath string, ops []utils.EnvEditOp) tea.Cmd

SaveEnvFile applies edits to the .env file and returns a message.

func SetActivePage

func SetActivePage(pageTitle string) func() tea.Msg

func SetBodyLayout

func SetBodyLayout(leftWidth, rightWidth, height int) tea.Cmd

func SetComposeFile

func SetComposeFile(name string, others []string) tea.Cmd

func SetEditingState

func SetEditingState(editing bool) tea.Cmd

SetEditingState returns a message that broadcasts the panel's edit state.

func SetGroupsList

func SetGroupsList(groups []GroupStatus) tea.Cmd

func SetHomeStats

func SetHomeStats(groups, services, running, ungrouped int) tea.Cmd

func SetListFilterState

func SetListFilterState(state list.FilterState) tea.Cmd

func SetPendingAction

func SetPendingAction(action string, target string, isGroup bool) tea.Cmd

SetPendingAction returns a command that announces a docker action is starting.

func SetSelectedGroup

func SetSelectedGroup(group string) tea.Cmd

func SetSelectedService

func SetSelectedService(service types.ServiceConfig) tea.Cmd

func SetServicesList

func SetServicesList(services []types.ServiceConfig) tea.Cmd

func SetUngroupedMaterialized added in v0.5.0

func SetUngroupedMaterialized(materialized bool) tea.Cmd

SetUngroupedMaterialized broadcasts the materialized state of the reserved ungrouped profile after a config reload.

func SwitchComposeFile

func SwitchComposeFile(path string) tea.Cmd

func WaitForLog

func WaitForLog(ch <-chan string) tea.Cmd

WaitForLog blocks on the next line from the stream channel, then drains any further lines already waiting without blocking, and turns them into one batch message. The LogsModal re-issues this cmd after every LogLinesMsg to pull the following batch, which is how the stream keeps flowing through Bubble Tea's Update loop without a blocking read on the main goroutine.

Types

type AddEnvVariableRequestMsg

type AddEnvVariableRequestMsg struct {
	Key   string
	Value string
}

type AddHealthcheckMsg

type AddHealthcheckMsg struct {
	ServiceName string
	Err         error
}

AddHealthcheckMsg reports the result of inserting or replacing a service's healthcheck: block.

type AddHealthcheckRequestMsg

type AddHealthcheckRequestMsg struct {
	ServiceName string
	Template    utils.HealthcheckTemplate
	Port        string
}

AddHealthcheckRequestMsg asks AppModel to apply template to serviceName. The picker emits this instead of the command itself: like every other write-path modal, it has no business knowing which compose file is loaded.

type AddServiceMsg

type AddServiceMsg struct {
	ServiceName string
	Image       string
	Fragment    []byte
	Err         error
}

AddServiceMsg reports the result of writing a new service into the compose file. Image and Fragment (set on success) are what AppModel needs to open the inline editor on the new service without waiting on a separate reload's selection broadcast to land first - see the Select field on InlineEditReadyMsg.

type AdoptUngroupedMsg added in v0.5.0

type AdoptUngroupedMsg struct {
	Err error
}

type ApplyThemeMsg

type ApplyThemeMsg struct {
	Name string
}

ApplyThemeMsg asks AppModel to make a theme permanent: set it as the active theme and write it to the config file. The modal has already previewed it live; this is the "user pressed Enter" step.

type BackupListMsg added in v0.4.0

type BackupListMsg struct {
	// Source is the file the list was read for, kept for callers that want
	// to distinguish the page-level read from a single-source re-list.
	Source string
	// Entries is newest-first, merged across compose and .env.
	Entries []utils.BackupEntry
	// Err is set when the store could not be read.
	Err error
}

BackupListMsg carries the merged list of stored versions for the live sources the Backups page covers: the compose file and the .env (when one is known). Source names which file each row restores, so a single list can mix both without losing track of where the copy came from.

type CancelInlineEditMsg

type CancelInlineEditMsg struct{}

CancelInlineEditMsg tells the panel to abandon inline editing without saving. Emitted by the follow-up of the discard-changes confirmation.

type ClearPendingActionMsg

type ClearPendingActionMsg struct{}

ClearPendingActionMsg signals that the pending docker action has completed.

type CloseModalMsg

type CloseModalMsg struct {
	Follow tea.Cmd
}

CloseModalMsg tells AppModel to clear the active modal. Follow, if set, is appended to the batch of commands run once the modal is gone - this is how a modal hands off the action it collected input for (e.g. actually creating a group) without needing to know about AppModel itself.

type ComposeFileContentsMsg

type ComposeFileContentsMsg struct {
	Name     string
	Contents string
	Err      error
}

ComposeFileContentsMsg carries the raw text of a compose file for the Files page's read-only viewport. Name is the path it was read from; Contents is the file's bytes as-is (comments, blank lines and all).

type ComposeFileListMsg

type ComposeFileListMsg struct {
	Dir   string
	Files []string
	Err   error
}

ComposeFileListMsg carries the YAML files found in a directory, so the file picker modal can list them. Dir is the directory that was scanned, which the picker needs to turn a chosen name back into a path.

type CreateComposeFileMsg

type CreateComposeFileMsg struct {
	Err error
}

type CreateGroupMsg

type CreateGroupMsg struct {
	Err error
}

type CreateGroupRequestMsg

type CreateGroupRequestMsg struct {
	Name     string
	Services []string
}

CreateGroupRequestMsg asks AppModel to create a group. The checklist modal emits this instead of the command itself: like the details panels, it has no business knowing which compose file is loaded.

type CycleRestartPolicyMsg added in v0.5.0

type CycleRestartPolicyMsg struct {
	ServiceName string
	Policy      string
	Err         error
}

CycleRestartPolicyMsg reports the result of advancing a service's restart: policy to the next value in the cycle.

type CycleRestartPolicyRequestMsg added in v0.5.0

type CycleRestartPolicyRequestMsg struct {
	ServiceName string
}

CycleRestartPolicyRequestMsg asks AppModel to advance serviceName's restart: policy. The details panel emits this instead of the command itself: like every other write-path action, it has no business knowing which compose file is loaded or what the service's current policy is - both live on AppModel's loaded config.

type DeleteEnvVariableRequestMsg

type DeleteEnvVariableRequestMsg struct {
	Key string
}

type DeleteGroupMsg

type DeleteGroupMsg struct {
	Err error
}

type DeleteServiceMsg added in v0.5.0

type DeleteServiceMsg struct {
	Err error
}

type DockerActionMsg

type DockerActionMsg struct {
	Action  string
	Target  string
	IsGroup bool
	Err     error
}

type DockerStatusMsg

type DockerStatusMsg struct{ Status utils.DockerStatus }

DockerStatusMsg carries the result of a docker preflight probe: the startup check, or a re-probe triggered by a docker call's own error - see D4 in docs/plans/docker-preflight.md.

type DockerUsageMsg

type DockerUsageMsg struct {
	Disk       []utils.DiskUsage
	MemTotal   int64
	Containers []apptypes.DockerContainer // passed in from AppModel to sum memory
	Err        error
}

DockerUsageMsg carries the disk usage and memory total from `docker system df` and `docker info`. If Err is set, the fetch failed and the overlay should show the error (or defer to the preflight diagnosis).

type EditEnvVariableRequestMsg

type EditEnvVariableRequestMsg struct {
	Key   string
	Value string
}

type EditGroupMsg

type EditGroupMsg struct {
	Err error
}

type EditGroupRequestMsg

type EditGroupRequestMsg struct {
	GroupName string
	Members   []string
}

EditGroupRequestMsg asks AppModel to reconcile a group's membership. The checklist modal emits this instead of the command itself: like the details panels, it has no business knowing which compose file is loaded.

type EditorClosedMsg

type EditorClosedMsg struct {
	Err error
}

EditorClosedMsg reports that the editor exited and the app has the terminal back. Err is set if the editor could not be started or exited non-zero.

type EnvEntry

type EnvEntry struct {
	Key   string // "" for comments/blank lines
	Value string
	Raw   string // The original line as it appears in the file
	// Source indicates what this entry is: "var", "comment", "blank", "parse_error"
	Source string
}

EnvEntry represents one line from the .env file.

type EnvFileContentsMsg

type EnvFileContentsMsg struct {
	Path    string     // Resolved .env path
	Entries []EnvEntry // Parsed entries in file order
	Err     error
}

type GetConfigMsg

type GetConfigMsg = struct {
	FileName string
	// Files is every compose-file candidate that exists in the directory, in
	// Docker's priority order, so Files[0] is FileName. The rest are the
	// candidates that lost - the footer counts them and the help overlay
	// lists them. Empty in tests that construct the message by hand.
	Files     []string
	Project   *types.Project
	EnvPath   string // Resolved .env path (compose-go semantics)
	EnvLoaded bool   // Whether .env was actually consumed by compose-go
	Err       error
}

type GetContainerStatsMsg

type GetContainerStatsMsg struct {
	Containers []apptypes.DockerContainer
	Err        error
	Background bool
}

GetContainerStatsMsg carries containers enriched with runtime stats from `docker stats`. Containers is always the full set the poll found, enriched when the stats call succeeded and plain when it did not: a background poll withholds its own GetRunningContainersMsg from the panels and lets this message deliver the data, so dropping it here would freeze every panel until the next foreground refresh. Err reports the stats failure for callers that care; it never means "no containers".

type GetRunningContainersMsg

type GetRunningContainersMsg struct {
	Containers []apptypes.DockerContainer
	Err        error
	// Background marks a result produced by the periodic poll rather than by
	// a page switch or a docker action. AppModel uses it to keep background
	// results from clearing an error banner they didn't cause.
	Background bool
}

type GroupStatus added in v0.5.0

type GroupStatus struct {
	Name    string
	Running int
	Total   int
}

GroupStatus carries one group's name and how many of its member services are running, so the groups list can render a status dot per row.

type InlineEditReadyMsg

type InlineEditReadyMsg struct {
	ServiceName string
	Fragment    []byte
	Err         error
	Select      *types.ServiceConfig
}

InlineEditReadyMsg carries the YAML fragment the panel should put into the inline editor. Err means the fragment could not be extracted; the panel is not yet in edit mode and should not enter it.

Select, when set, is the service the panel should adopt as m.service before entering edit mode. nil for the ordinary path ('e' on an already-selected service, where the panel's current selection is already right); set when the caller cannot assume a prior SetSelectedServiceMsg has already reached the panel - a service AddServiceModal just created, before the reload it also kicks off can be guaranteed to have landed: tea.Batch makes no ordering promises between sibling commands, so selection and edit-readiness have to travel in the same message to be atomic.

type LogLinesMsg added in v0.5.0

type LogLinesMsg []string

LogLinesMsg carries a batch of one or more lines read from the log stream. WaitForLog drains every line already buffered on the channel into one batch instead of returning after the first, so the initial `--tail` replay (which the producer sends in a tight burst) reaches the LogsModal as a single Update instead of one render per line - the render-per-line version was visible as the log scrolling to the bottom right after the modal opened, instead of opening already pinned there.

type LogStreamEndedMsg

type LogStreamEndedMsg struct{}

LogStreamEndedMsg is sent once the log channel closes (process exited or the stream was cancelled).

type OpenAboutModalMsg

type OpenAboutModalMsg struct{}

OpenAboutModalMsg asks AppModel to open the About modal. Going through a message (rather than AppModel opening it straight from the key) is the same path every other modal takes.

type OpenAddServiceModalMsg

type OpenAddServiceModalMsg struct{}

OpenAddServiceModalMsg asks AppModel to open the "add a service" modal - n on the Services page. Same path every other modal takes.

type OpenComposeFilePickerMsg

type OpenComposeFilePickerMsg struct{}

OpenComposeFilePickerMsg asks AppModel to open the file picker. The panel emits this rather than scanning the directory itself: which directory the active file lives in is AppModel's business, not a component's.

type OpenConfirmModalMsg

type OpenConfirmModalMsg struct {
	Message string
	Follow  tea.Cmd
}

type OpenCreateGroupModalMsg

type OpenCreateGroupModalMsg struct{}

type OpenDeleteGroupModalMsg

type OpenDeleteGroupModalMsg string

type OpenDeleteServiceModalMsg added in v0.5.0

type OpenDeleteServiceModalMsg string

type OpenEditGroupModalMsg

type OpenEditGroupModalMsg struct {
	GroupName string
}

OpenEditGroupModalMsg asks AppModel to open the service checklist pre- checked with groupName's current members. The modal emits an EditGroupRequestMsg on save; AppModel turns it into EditGroup with the loaded file.

type OpenEditorMsg

type OpenEditorMsg struct{}

OpenEditorMsg asks AppModel to hand the terminal to the user's editor. Panels emit this rather than the command itself: which file is open is config state that belongs to AppModel, not to a panel.

type OpenEnvDeleteConfirmMsg

type OpenEnvDeleteConfirmMsg struct {
	Key string
}

OpenEnvDeleteConfirmMsg requests opening the confirm modal for deleting a variable.

type OpenEnvEditModalMsg

type OpenEnvEditModalMsg struct {
	Key   string
	Value string
}

OpenEnvEditModalMsg requests opening the modal for editing an env variable value.

type OpenEnvKeyModalMsg

type OpenEnvKeyModalMsg struct{}

OpenEnvKeyModalMsg requests opening the modal for adding a new env variable.

type OpenEnvModalMsg added in v0.4.0

type OpenEnvModalMsg struct{}

OpenEnvModalMsg opens the env modal: the .env variable table, editor, and raw edit, all inside one centered modal. The global v key emits this.

type OpenEnvRawEditMsg

type OpenEnvRawEditMsg struct{}

OpenEnvRawEditMsg requests opening the raw .env file editor (textarea).

type OpenErrorModalMsg

type OpenErrorModalMsg struct {
	Message string
}

OpenErrorModalMsg opens an error modal with the given message. Used for foreground errors (docker actions, config loads) where a modal is less disruptive than the banner. Background poll errors keep the banner.

type OpenHealthcheckPickerMsg

type OpenHealthcheckPickerMsg struct {
	ServiceName string
}

OpenHealthcheckPickerMsg asks AppModel to open the healthcheck template picker for serviceName - h on the Services details panel.

type OpenHelpModalMsg

type OpenHelpModalMsg struct{}

type OpenLogsModalMsg

type OpenLogsModalMsg struct {
	Target  string
	IsGroup bool
}

OpenLogsModalMsg asks AppModel to open the streaming logs overlay for a single service (IsGroup false) or a whole group (IsGroup true).

type OpenRenameGroupModalMsg

type OpenRenameGroupModalMsg struct {
	GroupName string
}

OpenRenameGroupModalMsg asks AppModel to open the rename prompt for groupName. The modal emits a RenameGroupRequestMsg on save; AppModel turns it into RenameGroup with the loaded file.

type OpenServiceEditorMsg

type OpenServiceEditorMsg struct {
	ServiceName string
}

OpenServiceEditorMsg asks AppModel to open one service for editing in the user's $EDITOR. The panel emits this rather than the command itself, because which compose file is loaded is AppModel's business.

type OpenThemePickerMsg

type OpenThemePickerMsg struct{}

OpenThemePickerMsg asks AppModel to open the theme picker modal. Going through a message (rather than AppModel opening it straight from the key) is the same path every other modal takes.

type OpenUsageOverlayMsg

type OpenUsageOverlayMsg struct{}

OpenUsageOverlayMsg asks AppModel to open the Usage overlay. Going through a message (rather than AppModel opening it straight from the key) is the same path every other modal takes.

type RefreshContainersTickMsg

type RefreshContainersTickMsg time.Time

type ReleaseUngroupedMsg added in v0.5.0

type ReleaseUngroupedMsg struct {
	Err error
}

type RenameGroupMsg

type RenameGroupMsg struct {
	Err error
	// NewName rides the result so AppModel can keep the renamed group
	// selected after the reload - selection.groupName still holds the old
	// name until then.
	NewName string
}

type RenameGroupRequestMsg

type RenameGroupRequestMsg struct {
	GroupName string
	NewName   string
}

RenameGroupRequestMsg asks AppModel to rename GroupName to NewName in the loaded compose file. The rename modal emits this instead of the command itself, the same split as CreateGroupRequestMsg.

type RequestInlineEditMsg

type RequestInlineEditMsg struct {
	ServiceName string
}

RequestInlineEditMsg asks AppModel to prepare the YAML fragment for one service so the panel can edit it inline. AppModel answers with InlineEditReadyMsg.

type RequestRestoreBackupMsg added in v0.4.0

type RequestRestoreBackupMsg struct {
	Source string
	Name   string
}

RequestRestoreBackupMsg asks AppModel to confirm and then perform a restore of the named .bak over its live source file. Source is "compose" or ".env" so the model can resolve the live path the copy belongs to.

type RequestSaveServiceMsg

type RequestSaveServiceMsg struct {
	ServiceName string
	Fragment    []byte
}

RequestSaveServiceMsg asks AppModel to save an edited service fragment back to the compose file. AppModel applies it and answers with ServiceSavedMsg.

type RestoreBackupMsg added in v0.4.0

type RestoreBackupMsg struct {
	Err error
}

RestoreBackupMsg reports the outcome of a restore requested through the Backups page. Err is set when the restore failed.

type RunDockerActionMsg

type RunDockerActionMsg struct {
	Action  string
	Target  string
	IsGroup bool
}

RunDockerActionMsg asks AppModel to run a docker action. Panels emit this rather than the command itself, for the same reason they emit OpenEditorMsg: the action has to run against the compose file the app resolved, and that is AppModel's state, not a panel's.

type SaveEnvFileMsg

type SaveEnvFileMsg struct {
	Path string // The .env file path
	Err  error
}

type ServiceEditedMsg

type ServiceEditedMsg struct {
	ServiceName string
	Err         error
}

ServiceEditedMsg reports the outcome of the $EDITOR path. Err covers everything that can go wrong between opening the editor and writing the file; the compose file is untouched whenever it is set.

type ServiceSavedMsg

type ServiceSavedMsg struct {
	ServiceName string
	Err         error
}

ServiceSavedMsg reports the outcome of an inline save. The panel is the one that keeps the editor open, so the error belongs inline there; the banner is not set for this message.

type SetActivePageMsg

type SetActivePageMsg string

type SetBodyLayoutMsg

type SetBodyLayoutMsg struct {
	LeftWidth  int
	RightWidth int
	Height     int
}

SetBodyLayoutMsg is the exact box each body panel must render into. AppModel is the single source of truth for these numbers: it guarantees LeftWidth + constants.BODY_GUTTER_WIDTH + RightWidth == the terminal width, and that Height is the row count left after the nav, the keybinding bar, and the optional error banner.

Components must render at exactly this size rather than deriving their own from tea.WindowSizeMsg. WindowSizeMsg only reaches the components of the page that is active when it arrives, so any page that wasn't active at resize time would otherwise render at width 0. Both axes travel in one message so they can never be out of sync mid-frame.

type SetComposeFileMsg

type SetComposeFileMsg struct {
	// Name is the winning candidate. Empty means none is loaded, which is the
	// bootstrap state and the state left behind by a failed load.
	Name string
	// Others are the candidates that lost, in priority order. The footer
	// marks the winner with +N when there are any; the help overlay lists
	// them. Empty when the winner was the only candidate.
	Others []string
}

SetComposeFileMsg carries the compose file the app resolved, so the footer can say which one won - and how many others were in the running. Docker resolves the file itself (every utils.DockerCompose* call shells out without -f), so this is a report, not a setting.

type SetEditingStateMsg

type SetEditingStateMsg bool

SetEditingStateMsg tells the app whether the service details panel is in inline edit mode. The footer needs this to swap the action hints for the editor hints, and AppModel uses it to keep the help overlay in sync.

type SetGroupsListMsg

type SetGroupsListMsg []GroupStatus

type SetHomeStatsMsg

type SetHomeStatsMsg struct {
	Groups    int
	Services  int
	Running   int
	Ungrouped int
}

SetHomeStatsMsg carries the counts shown in the home page status header. Groups is the number of distinct groups (Compose profiles) in the loaded project. Services is the total number of services (across all profiles). Running is the number of containers currently in the "running" state. Ungrouped is the number of services that carry no profile tag at all - Compose starts these alongside *every* group regardless of which one was asked for, so they are worth a standing count rather than something the user only discovers by tracing a failed start back to a service they never selected.

type SetListFilterStateMsg

type SetListFilterStateMsg list.FilterState

SetListFilterStateMsg carries how much of the keyboard the focused list has taken, so the footer can advertise the keys that actually work: while a filter is being typed the panel verbs are inert, and once one is applied there is an esc that clears it which nothing else would mention.

It is broadcast on the transition rather than every keystroke, the same as every other Set* message here.

type SetPendingActionMsg

type SetPendingActionMsg struct {
	Action  string
	Target  string
	IsGroup bool
}

SetPendingActionMsg signals that a docker action is in progress. The panels show a spinner and disable action keys until it completes.

type SetSelectedGroupMsg

type SetSelectedGroupMsg string

type SetSelectedServiceMsg

type SetSelectedServiceMsg types.ServiceConfig

type SetServicesListMsg

type SetServicesListMsg []types.ServiceConfig

type SetUngroupedMaterializedMsg added in v0.5.0

type SetUngroupedMaterializedMsg bool

SetUngroupedMaterializedMsg tells the footer whether the reserved ungrouped row is backed by a written profile tag (materialized) or derived, so it can advertise the right 'A' verb (adopt vs release).

type SwitchComposeFileMsg

type SwitchComposeFileMsg struct {
	Path string
}

SwitchComposeFileMsg asks AppModel to make path the active compose file. The picker modal emits this as its follow-up; AppModel points the source at path and reloads, which is exactly what passing --file at startup does.

type ThemeAppliedMsg

type ThemeAppliedMsg struct {
	Name string
	Err  error
}

ThemeAppliedMsg is the result of an ApplyTheme command. AppModel reads Err to decide whether to show a banner; the modal closes either way (the theme was already previewed, so the user saw their choice).

type ToggleUngroupedRequestMsg added in v0.5.0

type ToggleUngroupedRequestMsg struct{}

ToggleUngroupedRequestMsg asks AppModel to show the adopt/release confirm for the reserved ungrouped row. AppModel decides which verb applies from the loaded project; the list only knows the row is selected.

Jump to

Keyboard shortcuts

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