repl

package module
v0.0.0-...-87ee7d1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(eval EvalFunc, opts ...Option) error

Start a Repl with the provided EvalFunc and Options. EvalFunc is called on enter.

Types

type EvalFunc

type EvalFunc func(ctx context.Context, txt string, r *Repl) (tea.Cmd, error)

type Option

type Option func(*Repl)

func WithIsQuitMessageF

func WithIsQuitMessageF(isQuitMessageF func(message tea.Msg) bool) Option

func WithPrompt

func WithPrompt(prompt string) Option

type Repl

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

func (Repl) ToViewport

func (r Repl) ToViewport(txt string) error

ToViewport writes to the internal buffer used to hold content for the viewport. This is expected to be called from inside of an EvalFunc, calling this from outside of an EvalFunc will cause it not to render until a tea.WindowSizeMsg or tea.KeyEnter is received within model.Update.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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