ui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserCancel = errors.New("user cancelled")

Functions

func RunUI

func RunUI(c Controller, opts Options) error

RunUI starts the gencmd UI with the provided controller and options.

func SelectProvider

func SelectProvider(providers []config.ProviderDoc) (string, map[string]string, error)

SelectProvider allows the user to select a provider and input its configuration.

Types

type Controller

type Controller interface {
	LoadHistory() []ctrl.HistoryEntry
	UpdateHistory(prompt, command string) error
	GenerateCommands(prompt string) ([]string, error)
}

type FakeController

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

func NewFakeController

func NewFakeController() *FakeController

func (*FakeController) GenerateCommands

func (f *FakeController) GenerateCommands(string) ([]string, error)

func (*FakeController) LoadHistory

func (f *FakeController) LoadHistory() []ctrl.HistoryEntry

func (*FakeController) UpdateHistory

func (f *FakeController) UpdateHistory(prompt, command string) error

type KeyMap

type KeyMap struct {
	Submit        key.Binding
	Cancel        key.Binding
	Up            key.Binding
	Down          key.Binding
	ToggleHistory key.Binding
}

func DefaultKeyMap

func DefaultKeyMap() KeyMap

type Model

type Model struct {
	KeyMap KeyMap
	// contains filtered or unexported fields
}

func New

func New(c Controller) Model

func (Model) FullHelp

func (m Model) FullHelp() [][]key.Binding

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) ShortHelp

func (m Model) ShortHelp() []key.Binding

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Options

type Options struct {
	TtyPath string
}

Jump to

Keyboard shortcuts

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