tui

package
v0.0.0-...-ba29e81 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment int
const (
	Left Alignment = iota
	Right
)

type Column

type Column struct {
	Header     string
	Position   int
	MaxWidth   int
	Alignment  Alignment
	TreePrefix bool
}

type ColumnConfiguration

type ColumnConfiguration map[ColumnID]Column

func (ColumnConfiguration) IDs

func (c ColumnConfiguration) IDs() []ColumnID

type ColumnID

type ColumnID int

type Command

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

func NewCommand

func NewCommand(width int, height int, prefix string) Command

func (*Command) Complete

func (c *Command) Complete(reverse bool)

func (Command) Draw

func (c Command) Draw(w Window)

func (*Command) Focus

func (c *Command) Focus()

func (Command) Input

func (c Command) Input() string

func (*Command) Process

func (c *Command) Process(ev *tcell.EventKey)

func (*Command) Resize

func (c *Command) Resize(width int, height int)

func (*Command) SetCompletions

func (c *Command) SetCompletions(suggestions Suggestions)

type HierarchicalTable

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

func NewHierarchicalTable

func NewHierarchicalTable(conf TableConfiguration, nodes []TableNode, width int, height int) (HierarchicalTable, error)

func (*HierarchicalTable) ActiveNodePath

func (t *HierarchicalTable) ActiveNodePath() []interface{}

func (*HierarchicalTable) Collapse

func (t *HierarchicalTable) Collapse(path ...interface{})

func (HierarchicalTable) Draw

func (t HierarchicalTable) Draw(w Window)

func (*HierarchicalTable) Process

func (t *HierarchicalTable) Process(ev *tcell.EventKey)

func (*HierarchicalTable) Replace

func (t *HierarchicalTable) Replace(nodes []TableNode)

func (*HierarchicalTable) Resize

func (t *HierarchicalTable) Resize(width int, height int)

func (*HierarchicalTable) ScrollToNextMatch

func (t *HierarchicalTable) ScrollToNextMatch(s string, ascending bool) bool

type Order

type Order struct {
	Valid     bool
	ID        ColumnID
	Ascending bool
}

type StyleTransform

type StyleTransform func(s tcell.Style) tcell.Style

func (StyleTransform) On

type StyleTransformDefinition

type StyleTransformDefinition struct {
	Foreground *string `toml:"foreground"`
	Background *string `toml:"background"`
	Bold       *bool   `toml:"bold"`
	Underlined *bool   `toml:"underlined"`
	Reversed   *bool   `toml:"reversed"`
	Dimmed     *bool   `toml:"dimmed"`
	Blink      *bool   `toml:"blink"`
}

func (StyleTransformDefinition) Parse

type StyledString

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

func Join

func Join(ss []StyledString, sep StyledString) StyledString

func NewStyledString

func NewStyledString(content string, ts ...StyleTransform) StyledString

func (*StyledString) Append

func (s *StyledString) Append(content string, t ...StyleTransform)

func (*StyledString) AppendString

func (s *StyledString) AppendString(other StyledString)

func (*StyledString) Apply

func (s *StyledString) Apply(t StyleTransform)

func (StyledString) Contains

func (s StyledString) Contains(value string) bool

func (*StyledString) Fit

func (s *StyledString) Fit(alignment Alignment, width int)

func (StyledString) Length

func (s StyledString) Length() int

func (StyledString) String

func (s StyledString) String() string

func (*StyledString) Truncate

func (s *StyledString) Truncate(width int)

func (*StyledString) TruncateLeft

func (s *StyledString) TruncateLeft(width int)

type Suggestion

type Suggestion struct {
	Value        string
	DisplayValue StyledString
	DisplayInfo  StyledString
}

type Suggestions

type Suggestions []Suggestion

func (Suggestions) Len

func (a Suggestions) Len() int

func (Suggestions) Less

func (a Suggestions) Less(i, j int) bool

func (Suggestions) Swap

func (a Suggestions) Swap(i, j int)

type TUI

type TUI struct {
	Eventc chan tcell.Event
	// contains filtered or unexported fields
}

func NewTUI

func NewTUI(newScreen func() (tcell.Screen, error), defaultStyle tcell.Style) (TUI, error)

func (TUI) Clear

func (t TUI) Clear()

func (TUI) Events

func (t TUI) Events() <-chan tcell.Event

func (*TUI) Exec

func (t *TUI) Exec(ctx context.Context, name string, args []string, stdin io.Reader) error

func (TUI) Finish

func (t TUI) Finish()

func (TUI) Show

func (t TUI) Show()

func (TUI) Size

func (t TUI) Size() (int, int)

func (*TUI) Window

func (t *TUI) Window(x, y, width, height int) Window

type TableConfiguration

type TableConfiguration struct {
	Sep                    string
	Cursor                 StyleTransform
	Header                 StyleTransform
	HeaderSuffixAscending  string
	HeaderSuffixDescending string
	Columns                ColumnConfiguration
	DefaultDepth           int
	NodeStyle              interface{}
	Order
}

type TableNode

type TableNode interface {
	// Unique identifier of this node among its siblings
	NodeID() interface{}
	NodeChildren() []TableNode
	Values(v interface{}) map[ColumnID]StyledString
	InheritedValues() []ColumnID
	Compare(other TableNode, id ColumnID, v interface{}) int
}

type TextArea

type TextArea struct {
	Content []StyledString
	// contains filtered or unexported fields
}

func NewTextArea

func NewTextArea(width, height int) (TextArea, error)

func (TextArea) Draw

func (t TextArea) Draw(w Window)

func (*TextArea) Process

func (t *TextArea) Process(ev *tcell.EventKey)

func (*TextArea) Resize

func (t *TextArea) Resize(width int, height int)

func (*TextArea) WriteContent

func (t *TextArea) WriteContent(lines ...StyledString)

type Widget

type Widget interface {
	Resize(width int, height int)
	Draw(w Window)
	Process(k *tcell.EventKey)
}

type Window

type Window interface {
	Draw(x, y int, s StyledString)
	Window(x, y, width, height int) Window
}

Jump to

Keyboard shortcuts

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