tui

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdin  io.ReadCloser = os.Stdin
	Stdout io.Writer     = os.Stdout
	Stderr io.Writer     = os.Stderr
)
View Source
var SSHAPPMode bool

run as a ssh app

Functions

func Display

func Display[M Model[V], V any](ctx context.Context, m M) (V, error)

func IsRenderable

func IsRenderable() bool

func WrapWord

func WrapWord(text []byte, width int) []byte

Types

type ConfigInputModel

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

func NewConfigInputModel

func NewConfigInputModel(prompts ...string) *ConfigInputModel

func (*ConfigInputModel) Error

func (m *ConfigInputModel) Error() error

func (*ConfigInputModel) Init

func (m *ConfigInputModel) Init() tea.Cmd

func (*ConfigInputModel) Update

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

func (*ConfigInputModel) Value

func (m *ConfigInputModel) Value() []string

func (*ConfigInputModel) View

func (m *ConfigInputModel) View() string

type ConfirmModel

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

func NewConfimModel

func NewConfimModel(prompt string) *ConfirmModel

func (*ConfirmModel) Error

func (m *ConfirmModel) Error() error

func (*ConfirmModel) Init

func (m *ConfirmModel) Init() tea.Cmd

func (*ConfirmModel) Update

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

func (*ConfirmModel) Value

func (m *ConfirmModel) Value() bool

func (*ConfirmModel) View

func (m *ConfirmModel) View() string

type ContentModel added in v0.2.2

type ContentModel struct {
	Val  string
	Text string
	// contains filtered or unexported fields
}

func NewContentModel added in v0.2.2

func NewContentModel(text string, rendererName string) *ContentModel

func (*ContentModel) Error added in v0.2.2

func (m *ContentModel) Error() error

func (*ContentModel) Init added in v0.2.2

func (m *ContentModel) Init() tea.Cmd

func (*ContentModel) Update added in v0.2.2

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

func (*ContentModel) Value added in v0.2.2

func (m *ContentModel) Value() string

func (*ContentModel) View added in v0.2.2

func (m *ContentModel) View() string

type JSONRenderer

type JSONRenderer struct {
}

func (*JSONRenderer) Render

func (r *JSONRenderer) Render(text string) (string, error)

type MarkdownRender

type MarkdownRender struct {
}

func (MarkdownRender) Render

func (r MarkdownRender) Render(text string) (string, error)

type Model

type Model[T any] interface {
	tea.Model
	Value() T
	Error() error
}

type Renderer

type Renderer interface {
	Render(string) (string, error)
}

func NewRenderer added in v0.2.2

func NewRenderer(name string) Renderer

type SpinnerModel

type SpinnerModel[V any] struct {
	spinner.Model

	Val V
	// contains filtered or unexported fields
}

func NewSpinnerModel

func NewSpinnerModel[V any](hint string, do func() (V, error)) *SpinnerModel[V]

func (*SpinnerModel[V]) Error

func (s *SpinnerModel[V]) Error() error

func (*SpinnerModel[V]) Init

func (s *SpinnerModel[V]) Init() tea.Cmd

func (*SpinnerModel[V]) Update

func (s *SpinnerModel[V]) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*SpinnerModel[V]) Value

func (s *SpinnerModel[V]) Value() V

func (*SpinnerModel[V]) View

func (s *SpinnerModel[V]) View() string

type StreamModel

type StreamModel[E any, S chan E] struct {
	spinner.Model
	// contains filtered or unexported fields
}

func NewStreamModel

func NewStreamModel[E any, S chan E](stream S, rendererName string, onEvent func(event E) (string, error)) *StreamModel[E, S]

func (*StreamModel[E, S]) Error

func (s *StreamModel[E, S]) Error() error

func (*StreamModel[E, S]) Init

func (s *StreamModel[E, S]) Init() tea.Cmd

func (*StreamModel[E, S]) Update

func (s *StreamModel[E, S]) Update(msg tea.Msg) (m tea.Model, cmd tea.Cmd)

func (*StreamModel[E, S]) Value

func (s *StreamModel[E, S]) Value() string

func (*StreamModel[E, S]) View

func (s *StreamModel[E, S]) View() string

type TextAreaModel

type TextAreaModel struct {
	textarea.Model
	// contains filtered or unexported fields
}

func NewTextAreaModel

func NewTextAreaModel() *TextAreaModel

func (*TextAreaModel) Error

func (m *TextAreaModel) Error() error

func (*TextAreaModel) Init

func (m *TextAreaModel) Init() tea.Cmd

func (*TextAreaModel) Update

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

func (*TextAreaModel) Value

func (m *TextAreaModel) Value() string

func (*TextAreaModel) View

func (m *TextAreaModel) View() string

type TextRenderer

type TextRenderer struct {
	Style lipgloss.Style
}

func (*TextRenderer) Render

func (r *TextRenderer) Render(text string) (string, error)

type Viewport

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

func NewViewport

func NewViewport(title, content string) *Viewport

func (Viewport) Error

func (m Viewport) Error() error

func (Viewport) Init

func (m Viewport) Init() tea.Cmd

func (Viewport) Update

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

func (Viewport) Value

func (m Viewport) Value() string

func (Viewport) View

func (m Viewport) View() string

Jump to

Keyboard shortcuts

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