commander

package
v0.0.0-...-6c48755 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSimpleRow

func NewSimpleRow(id string, cells []string, enabled bool) *simpleRow

Types

type App

type App interface {
	Container
	Run() error
	Update()
	Quit()
}

type Client

type Client interface {
	NewRequest(resource *Resource) (*rest.Request, error)
	Get(ctx context.Context, resource *Resource, namespace string, name string, out runtime.Object) error
	Delete(ctx context.Context, resource *Resource, namespace string, name string) error
	List(ctx context.Context, resource *Resource, namespace string, out runtime.Object) error
	ListAsTable(ctx context.Context, resource *Resource, namespace string) (*metav1.Table, error)
	WatchAsTable(ctx context.Context, resource *Resource, namespace string) (watch.Interface, error)
}

type Color

type Color struct {
	Name  string
	Color tcell.Color
}

type Command

type Command struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(name string, arg ...string) *Command

func (Command) Args

func (c Command) Args() []string

func (Command) Envs

func (c Command) Envs() map[string]string

func (Command) Name

func (c Command) Name() string

func (Command) ToCmd

func (c Command) ToCmd() *exec.Cmd

func (*Command) WithEnv

func (c *Command) WithEnv(name, value string) *Command

type CommandBuilder

type CommandBuilder interface {
	Describe(namespace string, resType string, resName string) *Command
	Edit(namespace string, resType string, resName string) *Command
	PortForward(namespace string, pod string, port int32) *Command
	Exec(namespace string, pod string, container string, command string) *Command
	Logs(namespace string, pod string, container string, previous bool, follow bool) *Command
	Pager() []*Command
	LogPager() []*Command
}

type CommandExecutor

type CommandExecutor interface {
	Pipe(command ...*Command) error
}

type Config

type Config interface {
	Context() string
	Namespace() string
	Kubeconfig() string
	Factory() util.Factory
	Raw() api.Config
}

type ConfigAccessor

type ConfigAccessor func() Config

type ConfigUpdateFunc

type ConfigUpdateFunc func(config *pb.Config)

type ConfigUpdater

type ConfigUpdater interface {
	UpdateConfig(updateFunc ConfigUpdateFunc) error
}

type Configurable

type Configurable interface {
	ConfigUpdated(config *pb.Config)
}

type Container

type Container interface {
	Client() Client
	Config() Config
	ResourceProvider() ResourceProvider
	CommandBuilder() CommandBuilder
	CommandExecutor() CommandExecutor
	Screen() Screen
	StatusReporter() StatusReporter
	ConfigUpdater() ConfigUpdater
	Register(Configurable)
}

type ExecErr

type ExecErr struct {
	Err    error
	Output []byte
}

func (ExecErr) Error

func (e ExecErr) Error() string

type FocusManager

type FocusManager interface {
	HandleEvent(e tcell.Event, useStack bool) bool
	// Returns root widget which presents on top of focus stack
	Root() Widget
	// Put widget to focus stack
	Focus(widget Widget)
	// Remove focus from focused widget and reduce focus stack if not on root widget
	Blur()
	// Returns currently focused widget
	Current() Widget
	// Returns stack size
	StackSize() int
}

type KubernetesRow

type KubernetesRow struct {
	// contains filtered or unexported fields
}

func NewKubernetesRow

func NewKubernetesRow(row metav1.TableRow, withNamespace bool) (*KubernetesRow, error)

func (KubernetesRow) Age

func (k KubernetesRow) Age() time.Duration

func (KubernetesRow) Cells

func (k KubernetesRow) Cells() []string

func (KubernetesRow) Enabled

func (k KubernetesRow) Enabled() bool

func (KubernetesRow) Id

func (k KubernetesRow) Id() string

func (KubernetesRow) Metadata

type ListView

type ListView interface {
	MaxSizeWidget
	SelectedRow() Row
	SelectedRowId() string
	SelectId(id string)
}

type ListViewStyler

type ListViewStyler func(list ListView, row Row) Style

type MaxSizeWidget

type MaxSizeWidget interface {
	Widget
	MaxSize() (int, int)
}
type MenuItem interface {
	Title() string
	Widget() Widget
	Position() int
}
type MenuListView interface {
	ListView
	SelectedItem() MenuItem
	SelectItem(id string)
	SelectNext()
	SelectPrevious()
}

type NamespaceAccessor

type NamespaceAccessor interface {
	CurrentNamespace() string
}

type OpAdded

type OpAdded struct {
	Row      Row
	Index    *int
	SortById bool
}

func (OpAdded) Operation

func (o OpAdded) Operation()

type OpClear

type OpClear struct{}

func (OpClear) Operation

func (o OpClear) Operation()

type OpDeleted

type OpDeleted struct {
	RowId string
}

func (OpDeleted) Operation

func (o OpDeleted) Operation()

type OpInitFinished

type OpInitFinished struct{}

func (OpInitFinished) Operation

func (o OpInitFinished) Operation()

type OpInitStart

type OpInitStart struct{}

func (OpInitStart) Operation

func (o OpInitStart) Operation()

type OpModified

type OpModified struct {
	Row Row
}

func (OpModified) Operation

func (o OpModified) Operation()

type OpSetColumns

type OpSetColumns struct {
	Columns []string
}

func (OpSetColumns) Operation

func (o OpSetColumns) Operation()

type Operation

type Operation interface {
	Operation()
}
type Popup interface {
	MaxSizeWidget
	Reposition(view View)
}

type Resource

type Resource struct {
	Namespaced bool
	Resource   string
	Gk         schema.GroupKind
	Gvk        schema.GroupVersionKind
	Verbs      []string
}

func (Resource) GroupVersion

func (r Resource) GroupVersion() schema.GroupVersion

func (Resource) GroupVersionKind

func (r Resource) GroupVersionKind() schema.GroupVersionKind

func (Resource) GroupVersionResource

func (r Resource) GroupVersionResource() schema.GroupVersionResource

func (Resource) Scope

func (r Resource) Scope() meta.RESTScope

type ResourceContainer

type ResourceContainer interface {
	NamespaceAccessor
	Status() StatusReporter
	Client() Client
	ResourceProvider() ResourceProvider
	CommandBuilder() CommandBuilder
	CommandExecutor() CommandExecutor
	ScreenHandler() ScreenHandler
}

type ResourceListView

type ResourceListView interface {
	ListView
	Resource() *Resource
}

type ResourceMap

type ResourceMap map[schema.GroupKind]*Resource

type ResourceMenu

type ResourceMenu interface {
	MenuListView
}

type ResourceProvider

type ResourceProvider interface {
	Resources() (ResourceMap, error)
}

type Row

type Row interface {
	Id() string
	Cells() []string
	Enabled() bool
}

type RowProvider

type RowProvider chan []Operation

type RowWithAge

type RowWithAge interface {
	Age() time.Duration
}

type Screen

type Screen interface {
	ScreenHandler
	Widget
	Init(status StatusReporter, theme ThemeManager)
	SetWorkspace(workspace Workspace)
	Workspace() Workspace
	View() View
}

type ScreenHandler

type ScreenHandler interface {
	Status() StatusReporter
	UpdateScreen()
	Resize()
	Theme() ThemeManager
}

type StatusReporter

type StatusReporter interface {
	Widget
	Error(err error)
	Warning(msg string)
	Info(msg string)
	Confirm(msg string) bool
	LoadingStarted()
	LoadingFinished()
}

type StylableWidget

type StylableWidget interface {
	SetStyle(style Style)
	Style() Style
}

type Style

type Style = tcell.Style

type ThemeComponent

type ThemeComponent interface {
	Name() string
	Style(name string) Style
	SetStyle(name string, style Style)
}

type ThemeManager

type ThemeManager interface {
	Configurable
	GetStyle(name string) Style
	NextTheme()
	PrevTheme()
}

type View

type View interface {
	views.View
}

type Widget

type Widget interface {
	views.Widget
	IsFocused() bool
	OnFocus()
	OnBlur()
	OnShow()
	OnHide()
	IsVisible() bool
}

type Workspace

type Workspace interface {
	Widget
	ResourceContainer
	ConfigUpdater
	Init() error
	ShowPopup(title string, widget MaxSizeWidget)
	FocusManager() FocusManager
	Theme() ThemeManager
}

Jump to

Keyboard shortcuts

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