Documentation
¶
Index ¶
- Variables
- type ClearHistoryMsg
- type Config
- type EvaluationCompleteMsg
- type Evaluator
- type EvaluatorResult
- type ExampleEvaluator
- type ExternalEditorCompleteMsg
- type ExternalEditorMsg
- type History
- func (h *History) Add(input, output string, isErr bool)
- func (h *History) Clear()
- func (h *History) GetAll() []string
- func (h *History) GetEntries() []HistoryEntry
- func (h *History) IsNavigating() bool
- func (h *History) NavigateDown() string
- func (h *History) NavigateUp() string
- func (h *History) ResetNavigation()
- type HistoryEntry
- type HistoryNavigationMsg
- type Model
- func (m *Model) AddCustomCommand(name string, handler func([]string) tea.Cmd)
- func (m *Model) AddCustomCommandRaw(name string, handler func(string, []string) tea.Cmd)
- func (m *Model) GetHistory() *History
- func (m Model) Init() tea.Cmd
- func (m *Model) SetStyles(styles Styles)
- func (m *Model) SetTheme(theme Theme)
- func (m *Model) SetWidth(width int)
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() string
- type MultilineModeToggleMsg
- type QuitMsg
- type SlashCommandMsg
- type Styles
- type Theme
Constants ¶
This section is empty.
Variables ¶
var BuiltinThemes = map[string]Theme{ "default": { Name: "Default", Styles: DefaultStyles(), }, "dark": { Name: "Dark", Styles: Styles{ Title: lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("15")). Background(lipgloss.Color("236")). Padding(0, 1), Prompt: lipgloss.NewStyle(). Foreground(lipgloss.Color("11")). Bold(true), Result: lipgloss.NewStyle(). Foreground(lipgloss.Color("14")), Error: lipgloss.NewStyle(). Foreground(lipgloss.Color("9")). Bold(true), Info: lipgloss.NewStyle(). Foreground(lipgloss.Color("3")). Italic(true), HelpText: lipgloss.NewStyle(). Foreground(lipgloss.Color("243")). Italic(true), }, }, "light": { Name: "Light", Styles: Styles{ Title: lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("0")). Background(lipgloss.Color("252")). Padding(0, 1), Prompt: lipgloss.NewStyle(). Foreground(lipgloss.Color("4")). Bold(true), Result: lipgloss.NewStyle(). Foreground(lipgloss.Color("6")), Error: lipgloss.NewStyle(). Foreground(lipgloss.Color("1")). Bold(true), Info: lipgloss.NewStyle(). Foreground(lipgloss.Color("130")). Italic(true), HelpText: lipgloss.NewStyle(). Foreground(lipgloss.Color("8")). Italic(true), }, }, }
BuiltinThemes provides predefined themes
Functions ¶
This section is empty.
Types ¶
type ClearHistoryMsg ¶
type ClearHistoryMsg struct{}
ClearHistoryMsg is sent when history should be cleared
type Config ¶
type Config struct {
Title string
Prompt string
Placeholder string
Width int
StartMultiline bool
EnableExternalEditor bool
EnableHistory bool
MaxHistorySize int
}
Config holds configuration for the REPL
type EvaluationCompleteMsg ¶
EvaluationCompleteMsg is sent when evaluation is complete
type Evaluator ¶
type Evaluator interface {
// Evaluate executes the given code and returns the result
Evaluate(ctx context.Context, code string) (string, error)
// GetPrompt returns the prompt string for this evaluator
GetPrompt() string
// GetName returns the name of this evaluator (for display)
GetName() string
// SupportsMultiline returns true if this evaluator supports multiline input
SupportsMultiline() bool
// GetFileExtension returns the file extension for external editor
GetFileExtension() string
}
Evaluator represents the interface for pluggable evaluators
type EvaluatorResult ¶
EvaluatorResult represents the result of an evaluation
type ExampleEvaluator ¶
type ExampleEvaluator struct {
// contains filtered or unexported fields
}
ExampleEvaluator is a simple evaluator for demonstration
func NewExampleEvaluator ¶
func NewExampleEvaluator() *ExampleEvaluator
NewExampleEvaluator creates a new example evaluator
func (*ExampleEvaluator) GetFileExtension ¶
func (e *ExampleEvaluator) GetFileExtension() string
GetFileExtension returns the file extension for external editor
func (*ExampleEvaluator) GetName ¶
func (e *ExampleEvaluator) GetName() string
GetName returns the evaluator name
func (*ExampleEvaluator) GetPrompt ¶
func (e *ExampleEvaluator) GetPrompt() string
GetPrompt returns the prompt string
func (*ExampleEvaluator) SupportsMultiline ¶
func (e *ExampleEvaluator) SupportsMultiline() bool
SupportsMultiline returns true if multiline is supported
type ExternalEditorCompleteMsg ¶
ExternalEditorCompleteMsg is sent when external editor is complete
type ExternalEditorMsg ¶
type ExternalEditorMsg struct {
Content string
}
ExternalEditorMsg is sent when external editor should be opened
type History ¶
type History struct {
// contains filtered or unexported fields
}
History manages command history for the REPL
func (*History) GetEntries ¶
func (h *History) GetEntries() []HistoryEntry
GetEntries returns all history entries
func (*History) IsNavigating ¶
IsNavigating returns true if currently navigating history
func (*History) NavigateDown ¶
NavigateDown moves down in history (to newer entries)
func (*History) NavigateUp ¶
NavigateUp moves up in history (to older entries)
func (*History) ResetNavigation ¶
func (h *History) ResetNavigation()
ResetNavigation resets the navigation state
type HistoryEntry ¶
HistoryEntry represents a single entry in the REPL history
type HistoryNavigationMsg ¶
type HistoryNavigationMsg struct {
}
HistoryNavigationMsg is sent when history navigation occurs
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model represents the UI state for the REPL
func (*Model) AddCustomCommand ¶
AddCustomCommand adds a custom slash command
func (*Model) AddCustomCommandRaw ¶ added in v0.0.27
AddCustomCommandRaw registers a command and provides the raw argument string alongside tokenized args.
func (*Model) GetHistory ¶
GetHistory returns the history object
type MultilineModeToggleMsg ¶
type MultilineModeToggleMsg struct {
Enabled bool
}
MultilineModeToggleMsg is sent when multiline mode is toggled
type SlashCommandMsg ¶
SlashCommandMsg is sent when a slash command is executed
type Styles ¶
type Styles struct {
Title lipgloss.Style
Prompt lipgloss.Style
Result lipgloss.Style
Error lipgloss.Style
Info lipgloss.Style
HelpText lipgloss.Style
}
Styles defines the visual styling for the REPL
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles returns the default styling configuration