example

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupHandler

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

func (*BackupHandler) Execute

func (h *BackupHandler) Execute()

func (*BackupHandler) GetCompactID added in v0.2.27

func (h *BackupHandler) GetCompactID() string

func (*BackupHandler) Label

func (h *BackupHandler) Label() string

func (*BackupHandler) Name

func (h *BackupHandler) Name() string

func (*BackupHandler) SetCompactID added in v0.2.27

func (h *BackupHandler) SetCompactID(id string)

func (*BackupHandler) SetLog added in v0.2.27

func (h *BackupHandler) SetLog(logger func(message ...any))

SetLog receives the logger from DevTUI

type ChatMessage

type ChatMessage struct {
	IsUser bool
	Text   string
	Time   time.Time
}

type CompilerModeHandler added in v0.3.9

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

CompilerModeHandler demonstrates devtui.HandlerSelection: a radio / segmented-control field. It exposes three mutually-exclusive build modes rendered as evenly distributed buttons in the footer. The active mode is highlighted; confirming a mode (Enter) calls Change(value).

It also implements ShortcutProvider, so the modes can be switched with the global keys l/m/s from any tab — both paths funnel through Change().

func NewCompilerModeHandler added in v0.3.9

func NewCompilerModeHandler() *CompilerModeHandler

NewCompilerModeHandler returns a handler starting in "Large" mode.

func (*CompilerModeHandler) Change added in v0.3.9

func (h *CompilerModeHandler) Change(newValue string)

Change is invoked when the user confirms an option (Enter) or presses a global shortcut. newValue is the selected option's key. It is normalized to upper-case so a lower-case shortcut ("l") still matches an option value ("L").

func (*CompilerModeHandler) Label added in v0.3.9

func (h *CompilerModeHandler) Label() string

func (*CompilerModeHandler) Name added in v0.3.9

func (h *CompilerModeHandler) Name() string

func (*CompilerModeHandler) Options added in v0.3.9

func (h *CompilerModeHandler) Options() []map[string]string

Options returns the ordered {value: label} pairs rendered as buttons. The map KEY is the value passed to Change(); the map VALUE is the caption.

func (*CompilerModeHandler) SetLog added in v0.3.9

func (h *CompilerModeHandler) SetLog(logger func(message ...any))

SetLog receives the logger from DevTUI.

func (*CompilerModeHandler) Shortcuts added in v0.3.9

func (h *CompilerModeHandler) Shortcuts() []map[string]string

Shortcuts registers global keys so the mode can be switched from any tab.

func (*CompilerModeHandler) Value added in v0.3.9

func (h *CompilerModeHandler) Value() string

type DatabaseHandler

type DatabaseHandler struct {
	ConnectionString string
	LastAction       string
	// contains filtered or unexported fields
}

func (*DatabaseHandler) Change

func (h *DatabaseHandler) Change(newValue string)

func (*DatabaseHandler) Label

func (h *DatabaseHandler) Label() string

func (*DatabaseHandler) Name

func (h *DatabaseHandler) Name() string

func (*DatabaseHandler) SetLog added in v0.2.27

func (h *DatabaseHandler) SetLog(logger func(message ...any))

SetLog receives the logger from DevTUI

func (*DatabaseHandler) Shortcuts

func (h *DatabaseHandler) Shortcuts() []map[string]string

NEW: Add shortcut support

func (*DatabaseHandler) Value

func (h *DatabaseHandler) Value() string

type LogLevelHandler added in v0.3.9

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

LogLevelHandler is a second HandlerSelection example with FOUR options and no global shortcuts, showing how the button row divides the footer width evenly for a different option count.

func NewLogLevelHandler added in v0.3.9

func NewLogLevelHandler() *LogLevelHandler

NewLogLevelHandler returns a handler starting at "info".

func (*LogLevelHandler) Change added in v0.3.9

func (h *LogLevelHandler) Change(newValue string)

func (*LogLevelHandler) Label added in v0.3.9

func (h *LogLevelHandler) Label() string

func (*LogLevelHandler) Name added in v0.3.9

func (h *LogLevelHandler) Name() string

func (*LogLevelHandler) Options added in v0.3.9

func (h *LogLevelHandler) Options() []map[string]string

func (*LogLevelHandler) SetLog added in v0.3.9

func (h *LogLevelHandler) SetLog(logger func(message ...any))

func (*LogLevelHandler) Value added in v0.3.9

func (h *LogLevelHandler) Value() string

type OperationLogWriter

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

func (*OperationLogWriter) GetLastOperationID

func (w *OperationLogWriter) GetLastOperationID() string

func (*OperationLogWriter) Name

func (w *OperationLogWriter) Name() string

func (*OperationLogWriter) SetLastOperationID

func (w *OperationLogWriter) SetLastOperationID(id string)

type SimpleChatHandler

type SimpleChatHandler struct {
	Messages []ChatMessage
	// ThinkDelay overrides the bot's "thinking" pause. Zero means a random 2–5s
	// (realistic); tests set a tiny value to stay fast.
	ThinkDelay   time.Duration
	CurrentInput string
	// contains filtered or unexported fields
}

func NewSimpleChatHandler

func NewSimpleChatHandler() *SimpleChatHandler

NewSimpleChatHandler creates a chat that starts waiting for input (edit mode auto-activates) with two separately-colored voices.

func (*SimpleChatHandler) BotVoice added in v0.3.9

func (h *SimpleChatHandler) BotVoice() any

func (*SimpleChatHandler) Change

func (h *SimpleChatHandler) Change(newValue string)

func (*SimpleChatHandler) Label

func (h *SimpleChatHandler) Label() string

func (*SimpleChatHandler) Name

func (h *SimpleChatHandler) Name() string

func (*SimpleChatHandler) UserVoice added in v0.3.9

func (h *SimpleChatHandler) UserVoice() any

UserVoice / BotVoice expose the two speakers so the app can register them with distinct colors, e.g.:

chat := example.NewSimpleChatHandler()
tui.AddHandler(chat, "", tab)                    // the input field
tui.AddHandler(chat.UserVoice(), "#3FB950", tab) // green "You" badge
tui.AddHandler(chat.BotVoice(), "#BC8CFF", tab)  // purple "Bot" badge

func (*SimpleChatHandler) Value

func (h *SimpleChatHandler) Value() string

func (*SimpleChatHandler) WaitingForUser

func (h *SimpleChatHandler) WaitingForUser() bool

WaitingForUser stays true so edit mode never closes: the reply is produced asynchronously, so if the field left edit mode the next keystroke would leak out as a global shortcut. This also lets you keep typing while the bot replies.

type StatusHandler

type StatusHandler struct{}

func (*StatusHandler) Content

func (h *StatusHandler) Content() string

func (*StatusHandler) Name

func (h *StatusHandler) Name() string

type SystemLogWriter

type SystemLogWriter struct{}

func (*SystemLogWriter) Name

func (w *SystemLogWriter) Name() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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