types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionResult

type ActionResult struct {
	Success     bool                   `json:"success"`
	Message     string                 `json:"message"`
	Data        interface{}            `json:"data,omitempty"`
	Error       string                 `json:"error,omitempty"`
	NextMenu    string                 `json:"next_menu,omitempty"`
	NextAction  string                 `json:"next_action,omitempty"`
	UpdateData  map[string]interface{} `json:"update_data,omitempty"`
	ShouldExit  bool                   `json:"should_exit,omitempty"`
	RefreshMenu bool                   `json:"refresh_menu,omitempty"`
}

ActionResult represents the result of executing an action

type AppState

type AppState int

AppState represents different states of the application

const (
	MainMenu AppState = iota
	DoneScreen
)
type Menu struct {
	ID            string          `yaml:"id"`
	Title         string          `yaml:"title"`
	Input         bool            `yaml:"input,omitempty"`
	Entries       []MenuEntry     `yaml:"entries,omitempty"`
	ConfirmAction *MenuAction     `yaml:"confirm_action,omitempty"`
	CancelKey     string          `yaml:"cancel_key,omitempty"`
	CancelNextID  string          `yaml:"cancel_next_id,omitempty"`
	Provider      string          `yaml:"provider,omitempty"`       // Provider to generate dynamic entries
	ProviderParam string          `yaml:"provider_param,omitempty"` // Parameter for the provider
	Map           map[string]Menu `yaml:"-"`
}

Menu represents a single menu definition

type MenuAction struct {
	Type        string                 `yaml:"type"`
	Target      string                 `yaml:"target,omitempty"`
	Command     string                 `yaml:"command,omitempty"`
	NextID      string                 `yaml:"next_id,omitempty"`
	Message     string                 `yaml:"message,omitempty"`
	Function    string                 `yaml:"function,omitempty"`     // Interactive function name
	Params      map[string]interface{} `yaml:"params,omitempty"`       // Parameters for functions
	Executor    string                 `yaml:"executor,omitempty"`     // Action executor ID
	ActionID    string                 `yaml:"action_id,omitempty"`    // Specific action within executor
	FilePath    string                 `yaml:"file_path,omitempty"`    // File path for file operations
	Confirm     bool                   `yaml:"confirm,omitempty"`      // Whether to show confirmation
	ConfirmText string                 `yaml:"confirm_text,omitempty"` // Custom confirmation message
}

MenuAction represents an action that can be taken

type MenuConfig struct {
	Menus []Menu `yaml:"menus"`
}

MenuConfig represents the complete menu configuration

type MenuEntry struct {
	Key         string                 `yaml:"key"`
	Label       string                 `yaml:"label"`
	Action      string                 `yaml:"action"`
	Target      string                 `yaml:"target,omitempty"`
	Message     string                 `yaml:"message,omitempty"`
	Command     string                 `yaml:"command,omitempty"`
	NextID      string                 `yaml:"next_id,omitempty"`
	FilePath    string                 `yaml:"file_path,omitempty"`    // For file-based actions
	Params      map[string]interface{} `yaml:"params,omitempty"`       // Parameters for interactive functions
	IsDynamic   bool                   `yaml:"-"`                      // Marks entries generated by functions
	Context     map[string]interface{} `yaml:"context,omitempty"`      // Additional context for this entry
	DisplayOnly bool                   `yaml:"display_only,omitempty"` // Entry is for display only (non-selectable)
	Condition   string                 `yaml:"condition,omitempty"`    // Condition to evaluate for showing this entry
	IsProvider  bool                   `yaml:"-"`                      // Marks entries from providers
	ProviderID  string                 `yaml:"-"`                      // ID of the provider that generated this entry
}

MenuEntry represents a single menu item

type ModelUpdate

type ModelUpdate struct {
	Model tea.Model
	Cmd   tea.Cmd
}

ModelUpdate represents a model update from a plugin

type NavMsg struct {
	Next          AppState
	NextID        string
	Data          any
	IsBack        bool                   // Flag to indicate this is a back navigation request
	Params        map[string]interface{} // Parameters passed from the triggering menu entry
	TitleOverride string                 // Override the target menu's title
}

NavMsg represents navigation messages between screens

type Result

type Result struct {
	Success bool        `json:"success"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
	Error   string      `json:"error,omitempty"`
}

Result represents the result of an operation

type TeaMsg

type TeaMsg tea.Msg

TeaMsg wraps Bubble Tea messages for plugins

type UpdateMsg

type UpdateMsg struct {
	Type    string
	Message string
	Data    interface{}
}

UpdateMsg represents screen update messages

Jump to

Keyboard shortcuts

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