devtui

package module
v0.0.43 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2025 License: MIT Imports: 15 Imported by: 0

README

devtui

interactive terminal user interface focused on developing applications

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessageTracker added in v0.0.43

func NewMessageTracker() *messageTracker

NewMessageTracker creates a new message tracker

Types

type AsyncMessageMsg added in v0.0.38

type AsyncMessageMsg tuiMessage

AsyncMessageMsg is a message from an async field handler

type ColorStyle

type ColorStyle struct {
	ForeGround string // eg: #F4F4F4
	Background string // eg: #000000
	Highlight  string // eg: #FF6600
	Lowlight   string // eg: #666666
}

type DevTUI

type DevTUI struct {
	*TuiConfig
	// contains filtered or unexported fields
}

DevTUI mantiene el estado de la aplicación

func DefaultTUIForTest added in v0.0.10

func DefaultTUIForTest(LogToFile func(messageErr any)) *DevTUI

NewDefaultTUI creates a DevTUI instance with basic default configuration useful for unit tests and for quick initialization in real applications

func NewTUI

func NewTUI(c *TuiConfig) *DevTUI

func (*DevTUI) ContentView

func (h *DevTUI) ContentView() string

ContentView renderiza los mensajes para una sección de contenido

func (*DevTUI) HandleKeyboard added in v0.0.10

func (h *DevTUI) HandleKeyboard(msg tea.KeyMsg) (bool, tea.Cmd)

HandleKeyboard processes keyboard input and updates the model state returns whether the update function should continue processing or return early

func (*DevTUI) Init

func (h *DevTUI) Init() tea.Cmd

Init initializes the terminal UI application.

func (*DevTUI) InitTUI added in v0.0.5

func (h *DevTUI) InitTUI(args ...any)

InitTUI initializes and runs the terminal UI application.

It accepts optional variadic arguments of any type. If a *sync.WaitGroup is provided among these arguments, InitTUI will call its Done() method before returning.

The method runs the UI using the internal tea engine, and handles any errors that may occur during execution. If an error occurs, it will be displayed on the console and the application will wait for user input before exiting.

Parameters:

  • args ...any: Optional arguments. Can include a *sync.WaitGroup for synchronization.

func (*DevTUI) NewTabSection added in v0.0.43

func (t *DevTUI) NewTabSection(title string, fhAdapters ...fieldHandlerAdapter) *tabSection

NewTabSection creates a new tab section

func (*DevTUI) Print

func (h *DevTUI) Print(messages ...any)

Print sends a normal Name or error to the tui in current tab

func (*DevTUI) ProcessFieldValueChange added in v0.0.38

func (h *DevTUI) ProcessFieldValueChange(field *fieldHandler, newValue string)

ProcessFieldValueChange handles field value changes

func (*DevTUI) ReturnFocus

func (t *DevTUI) ReturnFocus() error

func (*DevTUI) Update

func (h *DevTUI) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update maneja las actualizaciones del estado

func (*DevTUI) View

func (h *DevTUI) View() string

type IDGenerator added in v0.0.43

type IDGenerator interface {
	GetNewID() string
}

IDGenerator represents a unique ID generator

func NewIDGenerator added in v0.0.43

func NewIDGenerator() IDGenerator

Use the existing UnixID as an IDGenerator implementation

type MessageID added in v0.0.43

type MessageID string

Identificador único para mensajes

type MessageUpdate added in v0.0.43

type MessageUpdate struct {
	Content string
	Type    messagetype.Type
}

Actualización de estado para mensajes

type TuiConfig

type TuiConfig struct {
	AppName       string    // app name eg: "MyApp"
	TabIndexStart int       // is the index of the tab section to start
	ExitChan      chan bool //  global chan to close app
	Color         *ColorStyle

	LogToFile func(messageErr any) // function to write log error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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