ui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeySlash = 47
	KeyD     = 100
	KeyS     = 115
	KeyJ     = 106
	KeyK     = 107
)
View Source
const (
	HeaderRow   = "HeaderRow"
	TopRow      = "TopRow"
	Row         = "Row"
	SelectedRow = "SelectedRow"
	StoppedRow  = "StoppedRow"
	CommandRow  = "Command"
)

Variables

View Source
var (
	DefaultHandlers = HandlerMap{
		tcell.KeyCtrlC: HandleCtrlC,
		tcell.KeyUp:    HandleNavigateUp,
		tcell.KeyDown:  HandleNavigateDown,
		KeyK:           HandleNavigateUp,
		KeyJ:           HandleNavigateDown,
		KeyD:           HandleDescribe,
		KeyS:           HandleShell,
		KeySlash:       HandleSearch,
	}
)

Functions

func DrawHeaderBox added in v0.1.0

func DrawHeaderBox(s tcell.Screen, x, y, w, h int)

func DrawLine added in v0.1.0

func DrawLine(s tcell.Screen, x, y, l int)

func DrawStr added in v0.1.0

func DrawStr(s tcell.Screen, x, y int, style tcell.Style, str string)

func DrawTableBox added in v0.1.0

func DrawTableBox(s tcell.Screen, x, y, w, h int)

func HandleCtrlC

func HandleCtrlC(u *Ui)

func HandleDescribe added in v0.2.0

func HandleDescribe(u *Ui)

func HandleNavigateDown

func HandleNavigateDown(u *Ui)

func HandleNavigateUp

func HandleNavigateUp(u *Ui)

func HandleSearch added in v0.2.0

func HandleSearch(u *Ui)

func HandleShell added in v0.2.0

func HandleShell(u *Ui)

Types

type Handler

type Handler func(*Ui)

type HandlerMap

type HandlerMap map[tcell.Key]Handler

type HeaderInterface added in v0.1.0

type HeaderInterface interface {
	Rows() []string
}

type InfoHeader added in v0.1.0

type InfoHeader struct {
	UserIdentity client.CallerIdentity
	Region       string
}

func (*InfoHeader) Rows added in v0.1.0

func (u *InfoHeader) Rows() []string

type InstanceTable

type InstanceTable struct {
	Instances     []client.Instance
	Cursor        int
	Offset        int
	RowsDisplayed int
}

func NewInstanceTable added in v0.1.0

func NewInstanceTable(instances []client.Instance, n int) *InstanceTable

func (*InstanceTable) Columns added in v0.1.0

func (t *InstanceTable) Columns() []string

func (*InstanceTable) OnTableResize added in v0.1.0

func (t *InstanceTable) OnTableResize(nNew int)

func (*InstanceTable) Rows

func (t *InstanceTable) Rows() []string

type TableInterface added in v0.1.0

type TableInterface interface {
	Columns() []string
	Rows() []string
	OnTableResize(int)
}

type Ui

type Ui struct {
	Title    string
	Header   HeaderInterface
	Table    TableInterface
	Handlers HandlerMap
	Screen   tcell.Screen
	// contains filtered or unexported fields
}

func NewUi

func NewUi() *Ui

func (*Ui) GetScreen added in v0.1.0

func (u *Ui) GetScreen() tcell.Screen

func (*Ui) NumberOfRowsDisplayed added in v0.1.0

func (u *Ui) NumberOfRowsDisplayed() int

func (*Ui) Render added in v0.1.0

func (u *Ui) Render()

func (*Ui) Run added in v0.2.0

func (u *Ui) Run() error

func (*Ui) SetHandlers

func (u *Ui) SetHandlers(h HandlerMap) *Ui

func (*Ui) SetHeader added in v0.1.0

func (u *Ui) SetHeader(h HeaderInterface) *Ui

func (*Ui) SetTable

func (u *Ui) SetTable(t TableInterface) *Ui

func (*Ui) SetTitle

func (u *Ui) SetTitle(s string) *Ui

type UiInterface added in v0.1.0

type UiInterface interface {
	Render()
	GetScreen() tcell.Screen
}

Jump to

Keyboard shortcuts

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