tui

package module
v0.0.0-...-bbfa983 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandError = ""

Functions

func RunCommand

func RunCommand(fp string, logLeaf *StringLeaf, quitLeaf *Leaf[error])

Command: run path

func StartTui

func StartTui(config *GreenTeaConfig)

func TestCommand

func TestCommand(fp string, console *StringLeaf) error

Command: test path

Types

type GreenTeaConfig

type GreenTeaConfig struct {
	RefreshDelay int
	Commands     []*cli.Command
	LogLeaf      *StringLeaf
	QuitLeaf     *Leaf[error]  // once a print is added, the applecation quits with the added message
	CommandLeaf  *StringLeaf   // runs added commands in the tui
	ExitLeaf     *Leaf[func()] // functions to run on exit
}

type Leaf

type Leaf[T any] struct {
	// contains filtered or unexported fields
}

func NewLeaf

func NewLeaf[T any]() *Leaf[T]

Creates and return a new empty leaf

func (*Leaf[T]) Append

func (leaf *Leaf[T]) Append(item T)

Appends the given element to the leaf

func (*Leaf[T]) Clear

func (leaf *Leaf[T]) Clear()

Removes all remaining items for leaf

func (*Leaf[T]) GetAll

func (leaf *Leaf[T]) GetAll() []T

Return a slice of all items in leaf

func (*Leaf[T]) Harvest

func (leaf *Leaf[T]) Harvest() (T, bool)

Returns the oldest element and true, then removes it from the leaf. Return an empty var of type T and false if leaf has no elements

func (*Leaf[T]) HarvestAll

func (leaf *Leaf[T]) HarvestAll() []T

Returns all items from leaf and clears it.

type StringLeaf

type StringLeaf struct {
	Leaf[string]
}

func NewStringLeaf

func NewStringLeaf() *StringLeaf

Creates and return a new empty string leaf

func (*StringLeaf) Println

func (leaf *StringLeaf) Println(a ...any)

Implements fmt.Println()

func (*StringLeaf) Printlnf

func (leaf *StringLeaf) Printlnf(format string, a ...any)

Implements fmt.Printf() with a new line after

Jump to

Keyboard shortcuts

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