tui

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggerModel

func NewLoggerModel(c LoggerControl) tea.Model

func NewStatusModel

func NewStatusModel[T io.Closer](c *StatusControl[T]) tea.Model

func RunProgram

func RunProgram(model tea.Model, cancel context.CancelFunc, useStderr bool) tea.Model

RunProgram runs a tea.Program with a tea.Model as the initial model, which can switch itself to other model in its Update func.

Types

type LoggerControl

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

A LoggerControl is the user handler for a LoggerModel

func NewLoggerControl

func NewLoggerControl(debug bool) LoggerControl

func (LoggerControl) Debugf

func (c LoggerControl) Debugf(format string, a ...any)

Debugf appends a log entry when in debug mode

func (LoggerControl) End

func (c LoggerControl) End()

End terminates the program, preserving the log entries on screen

func (LoggerControl) Infof

func (c LoggerControl) Infof(format string, a ...any)

Infof appends a log entry

func (LoggerControl) Next

func (c LoggerControl) Next(m tea.Model)

Next switch the current model to the next one

type LoggerModel

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

A LoggerModel displays a stream of logs

func (LoggerModel) Init

func (m LoggerModel) Init() tea.Cmd

func (LoggerModel) Update

func (m LoggerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (LoggerModel) View

func (m LoggerModel) View() string

type StatusControl

type StatusControl[T io.Closer] struct {
	// contains filtered or unexported fields
}

A StatusControl is the user handler for a StausModel

func NewStatusControl

func NewStatusControl[T io.Closer]() *StatusControl[T]

func (StatusControl) Close

func (m StatusControl) Close() error

func (*StatusControl[T]) Monitor

func (c *StatusControl[T]) Monitor(stream T) T

Monitor wraps around a read/write stream for obtaining data transfer stats

func (*StatusControl[_]) Next

func (c *StatusControl[_]) Next(m tea.Model)

Next switches to the next BubbleTea Model and shut down current StatusModel

func (StatusControl) Read

func (m StatusControl) Read(p []byte) (n int, err error)

func (StatusControl) Write

func (m StatusControl) Write(p []byte) (n int, err error)

type StatusModel

type StatusModel[T io.Closer] struct {
	// contains filtered or unexported fields
}

A StatusModel displays a updating stats of data transfer

func (StatusModel[_]) Init

func (m StatusModel[_]) Init() tea.Cmd

func (StatusModel[_]) Update

func (m StatusModel[_]) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (StatusModel[_]) View

func (m StatusModel[_]) View() string

Jump to

Keyboard shortcuts

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