common

package
v0.49.104 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareValues

func CompareValues(a, b string) bool

Helper for smart comparison

func DockerCommand added in v0.49.81

func DockerCommand(app AppController, args ...string) *exec.Cmd

func FormatSC

func FormatSC(key, action string) string

Helper for footer shortcuts (legacy/logs)

func FormatSCHeader

func FormatSCHeader(key, action string) string

func FormatSCHeaderGlobal

func FormatSCHeaderGlobal(key, action string) string
func GetLogo() []string

func StripColorTags

func StripColorTags(text string) string

StripColorTags removes tview color tags from a string

Types

type AppController

type AppController interface {
	RefreshCurrentView()
	ActivateCmd(initial string)
	SwitchTo(viewName string)
	ExecuteCmd(cmd string)

	// Accessors
	GetPages() *tview.Pages
	GetTviewApp() *tview.Application
	GetScreen() tcell.Screen
	GetDocker() *dao.DockerClient
	GetConfig() *config.Config

	// Actions
	PerformAction(action func(id string) error, actionName string, color tcell.Color)
	GetActionState(viewName string, id string) (string, tcell.Color, bool)
	InspectCurrentSelection()

	// State
	IsReadOnly() bool
	GetActiveScope() *Scope
	SetActiveScope(scope *Scope)
	SetFilter(filter string)
	SetFlashText(text string)
	SetFlashMessage(text string, duration time.Duration)
	SetFlashError(text string)
	SetFlashPending(text string)
	SetFlashSuccess(text string)
	AppendFlash(text string, duration ...time.Duration)
	AppendFlashError(text string, duration ...time.Duration)
	AppendFlashPending(text string, duration ...time.Duration)
	AppendFlashSuccess(text string, duration ...time.Duration)
	RestoreFocus()

	// Direct access for command component (needed for handlers)
	GetActiveFilter() string
	SetActiveFilter(filter string)

	// Layout management
	SetCmdLineVisible(visible bool)
	SetFullscreen(enabled bool)
	UpdateShortcuts()

	ScheduleViewHighlight(viewName string, match func(dao.Resource) bool, bg, fg tcell.Color, duration time.Duration)

	// Inspector Management
	OpenInspector(inspector Inspector)
	CloseInspector()

	// Async Task Management
	RunInBackground(task func())
	SetPaused(paused bool)

	// Context Management
	SetDefaultContext(contextName string)
	ReloadContext(contextName string)

	// Port-Forward Management
	GetPortForwardManager() *portforward.Manager

	// Refactoring: Auto Refresh Control
	StartAutoRefresh()
	StopAutoRefresh()
}

AppController defines the methods that sub-components need from the main App

type Inspector

type Inspector interface {
	// GetPrimitive returns the tview component to be displayed
	GetPrimitive() tview.Primitive

	// GetID returns a unique ID for this inspector instance (usually "inspect")
	GetID() string

	// InputHandler handles keyboard events. Returns nil if handled.
	InputHandler(event *tcell.EventKey) *tcell.EventKey

	// Helpers for the App to display info
	GetTitle() string
	GetShortcuts() []string

	// Lifecycle
	OnMount(app AppController)
	OnUnmount()

	// ApplyFilter applies a search/filter to the inspector view
	ApplyFilter(filter string)
}

Inspector defines a component that can be shown in the inspection modal layer.

type Scope

type Scope struct {
	Type       string // e.g. "compose"
	Value      string // e.g. "project-name"
	Label      string // e.g. "~/docker-compose.yml"
	OriginView string // View which initiated this scope
	Parent     *Scope // Previous scope in the stack
}

Jump to

Keyboard shortcuts

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