Help us shape the future of Go! Take the 2026 Go Developer Survey

contexts

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ViewName = "contexts"

Variables

View Source
var PollInterval = 5 * time.Second

PollInterval is how often the view re-reads the context list. It is a var, not a const, so tests can shrink it: a tea.Tick cmd invoked synchronously blocks for the full interval, so a test that runs one to see what it scheduled would otherwise sit here for five seconds.

Functions

func GetContextsHelpContent

func GetContextsHelpContent() []helpview.HelpCategory

GetContextsHelpContent returns categorized help for the contexts view

func LoadCertFilesCmd

func LoadCertFilesCmd(dirPath string) tea.Cmd

LoadCertFilesCmd loads all files from a directory for cert file selection

func LoadFilesCmd

func LoadFilesCmd(dirPath string) tea.Cmd

LoadFilesCmd loads context archive files and directories from a path for browsing

Types

type ContextChangedNotification

type ContextChangedNotification struct {
	PreviousContext string
}

ContextChangedNotification is sent to notify the app that the Docker context has changed and should navigate to stacks view

type ContextCreatedMsg

type ContextCreatedMsg struct {
	ContextName string
	Success     bool
	Error       error
}

type ContextDeletedMsg

type ContextDeletedMsg struct {
	ContextName string
	Success     bool
	Error       error
}

type ContextExportedMsg

type ContextExportedMsg struct {
	ContextName string
	FilePath    string
	Success     bool
	Error       error
}

type ContextImportedMsg

type ContextImportedMsg struct {
	ContextName string
	Success     bool
	Error       error
}

type ContextSwitchedMsg

type ContextSwitchedMsg struct {
	ContextName string
	Success     bool
	Error       error
}

type ContextUpdatedMsg

type ContextUpdatedMsg struct {
	ContextName string
	// Reconnect reports that the active context's endpoint moved, so the
	// cached Docker client and snapshot have to be rebuilt.
	Reconnect bool
	Success   bool
	Error     error
}

type ContextsLoadedMsg

type ContextsLoadedMsg struct {
	Contexts []docker.ContextInfo
	Error    error
}

type FilesLoadedMsg

type FilesLoadedMsg struct {
	Path  string
	Files []string
	Error error
}

FilesLoadedMsg contains the list of context archive files in a directory

type Model

type Model struct {
	Visible bool

	List filterlist.FilterableList[docker.ContextInfo]
	// contains filtered or unexported fields
}

func New

func New() *Model

func (*Model) ApplySearchQuery

func (m *Model) ApplySearchQuery(query string)

ApplySearchQuery sets the filter query and applies it.

func (*Model) CapturesInput

func (m *Model) CapturesInput() bool

CapturesInput reports whether the view is currently capturing all keyboard input.

func (*Model) ClearSearchQuery

func (m *Model) ClearSearchQuery()

ClearSearchQuery clears the filter query and resets the view.

func (*Model) ClickRow added in v2.2.0

func (m *Model) ClickRow(line int) bool

ClickRow selects the context under a mouse click. Like the cursor keys it does nothing while a switch is pending, and nothing while the list is still loading, when the content is a placeholder rather than rows.

func (*Model) FrameContent

func (m *Model) FrameContent() string

func (*Model) FrameFooter

func (m *Model) FrameFooter() string

func (*Model) FrameHeader

func (m *Model) FrameHeader() string

func (*Model) FrameTitle

func (m *Model) FrameTitle() string

func (*Model) GetContexts

func (m *Model) GetContexts() []docker.ContextInfo

func (*Model) GetCursor

func (m *Model) GetCursor() int

func (*Model) GetError

func (m *Model) GetError() string

func (*Model) GetSelectedContext

func (m *Model) GetSelectedContext() (docker.ContextInfo, bool)

func (*Model) GetSuccess

func (m *Model) GetSuccess() string

func (*Model) HasActiveFilter

func (m *Model) HasActiveFilter() bool

HasActiveFilter reports whether a filter query is active.

func (*Model) HasErrors

func (m *Model) HasErrors() bool

func (*Model) HelpContent

func (m *Model) HelpContent() []helpview.HelpCategory

HelpContent implements the app's optional help-screen contract: "?" is handled centrally, and a view carrying its own screen supplies it here.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the model (part of View interface)

func (*Model) IsLoading

func (m *Model) IsLoading() bool

func (*Model) IsSearching

func (m *Model) IsSearching() bool

IsSearching reports whether the list is currently in search mode.

func (*Model) IsSwitchPending

func (m *Model) IsSwitchPending() bool

func (*Model) MoveCursor

func (m *Model) MoveCursor(delta int)

func (*Model) Name

func (m *Model) Name() string

Name returns the view name (part of View interface)

func (*Model) OnEnter

func (m *Model) OnEnter() tea.Cmd

OnEnter is called when the view becomes active

func (*Model) OnExit

func (m *Model) OnExit() tea.Cmd

OnExit is called when the view is exited

func (*Model) SetContexts

func (m *Model) SetContexts(contexts []docker.ContextInfo)

func (*Model) SetError

func (m *Model) SetError(err string)

func (*Model) SetLoading

func (m *Model) SetLoading(loading bool)

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

func (*Model) SetSuccess

func (m *Model) SetSuccess(msg string)

func (*Model) SetSwitchPending

func (m *Model) SetSwitchPending(pending bool)

func (*Model) ShortHelpItems

func (m *Model) ShortHelpItems() []helpbar.HelpEntry

ShortHelpItems returns the help items for the view

func (*Model) Update

func (m *Model) Update(msg tea.Msg) tea.Cmd

func (*Model) View

func (m *Model) View() string

type RefreshTickMsg

type RefreshTickMsg struct{ Gen uint64 }

RefreshTickMsg drives the periodic re-read. Gen names the poll chain it belongs to; see Model.OnEnter.

type SortField

type SortField int
const (
	SortByName SortField = iota
	SortByStatus
	SortByDescription
	SortByEndpoint
)

Jump to

Keyboard shortcuts

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