Documentation
¶
Index ¶
- func IsUnboundSpecialKey(key gocui.Key) bool
- type BasicShell
- func (s *BasicShell) ClearInput(v *gocui.View)
- func (s *BasicShell) DeleteWordBackward(v *gocui.View)
- func (s *BasicShell) Edit(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier)
- func (s *BasicShell) GetInputBuffer() string
- func (s *BasicShell) MoveBackwardChar(v *gocui.View)
- func (s *BasicShell) MoveToNextWord(v *gocui.View)
- func (s *BasicShell) MoveToPreviousWord(v *gocui.View)
- func (s *BasicShell) NavigateHistoryDown(v *gocui.View)
- func (s *BasicShell) NavigateHistoryUp(v *gocui.View)
- func (s *BasicShell) ResetHistoryNavigation()
- func (s *BasicShell) SetCursorToBeginning(v *gocui.View)
- func (s *BasicShell) SetCursorToEnd(v *gocui.View)
- func (s *BasicShell) SetInputBuffer(content string, v *gocui.View)
- type Command
- type CommandRegistry
- type CommandSuggester
- type Completer
- type MockRegistryForTesting
- type MockSlashCommandManager
- type MockSuggesterForTesting
- type Shell
- type SlashCommandManager
- type SlashCommandSuggester
- type Suggester
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUnboundSpecialKey ¶
IsUnboundSpecialKey checks if a key is a special key that should be ignored.
Types ¶
type BasicShell ¶
type BasicShell struct {
// contains filtered or unexported fields
}
BasicShell implements the gocui.Editor interface and provides core shell functionalities.
func NewBasicShell ¶
func NewBasicShell(completer *Completer, historyManager history.ChatHistory) *BasicShell
NewBasicShell creates a new instance of BasicShell.
func (*BasicShell) ClearInput ¶
func (s *BasicShell) ClearInput(v *gocui.View)
ClearInput clears the input buffer and resets the view.
func (*BasicShell) DeleteWordBackward ¶
func (s *BasicShell) DeleteWordBackward(v *gocui.View)
DeleteWordBackward deletes the word before the cursor (Ctrl+W)
func (*BasicShell) GetInputBuffer ¶
func (s *BasicShell) GetInputBuffer() string
GetInputBuffer returns the current content of the input buffer.
func (*BasicShell) MoveBackwardChar ¶
func (s *BasicShell) MoveBackwardChar(v *gocui.View)
MoveBackwardChar moves cursor backward one character (Ctrl+B)
func (*BasicShell) MoveToNextWord ¶
func (s *BasicShell) MoveToNextWord(v *gocui.View)
MoveToNextWord moves cursor to the next word boundary
func (*BasicShell) MoveToPreviousWord ¶
func (s *BasicShell) MoveToPreviousWord(v *gocui.View)
MoveToPreviousWord moves cursor to the previous word boundary
func (*BasicShell) NavigateHistoryDown ¶
func (s *BasicShell) NavigateHistoryDown(v *gocui.View)
NavigateHistoryDown moves forward in history (towards newer commands).
func (*BasicShell) NavigateHistoryUp ¶
func (s *BasicShell) NavigateHistoryUp(v *gocui.View)
NavigateHistoryUp moves backward in history (towards older commands).
func (*BasicShell) ResetHistoryNavigation ¶
func (s *BasicShell) ResetHistoryNavigation()
ResetHistoryNavigation resets the history navigation state.
func (*BasicShell) SetCursorToBeginning ¶
func (s *BasicShell) SetCursorToBeginning(v *gocui.View)
SetCursorToBeginning moves cursor to the beginning of the buffer
func (*BasicShell) SetCursorToEnd ¶
func (s *BasicShell) SetCursorToEnd(v *gocui.View)
SetCursorToEnd moves cursor to the end of the buffer
func (*BasicShell) SetInputBuffer ¶
func (s *BasicShell) SetInputBuffer(content string, v *gocui.View)
SetInputBuffer sets the content of the input buffer and updates the view.
type Command ¶
type Command struct {
Text string
}
Command represents a parsed command from the shell input. This is a minimal representation for now, focusing on the raw text.
type CommandRegistry ¶
type CommandRegistry interface {
GetCommandNames() []string
}
CommandRegistry interface defines what the CommandSuggester needs from a registry
func CreateTestCommandRegistry ¶
func CreateTestCommandRegistry() CommandRegistry
CreateTestCommandRegistry creates a mock command registry for testing
type CommandSuggester ¶
type CommandSuggester struct {
// contains filtered or unexported fields
}
CommandSuggester provides suggestions for internal commands (starting with :)
func NewCommandSuggester ¶
func NewCommandSuggester(registry CommandRegistry) *CommandSuggester
NewCommandSuggester creates a new command suggester with a command registry
func (*CommandSuggester) GetPrefix ¶
func (cs *CommandSuggester) GetPrefix() string
GetPrefix returns the prefix this suggester handles
func (*CommandSuggester) GetSuggestions ¶
func (cs *CommandSuggester) GetSuggestions(input string) []string
GetSuggestions returns suggestions based on the current input
func (*CommandSuggester) ShouldSuggest ¶
func (cs *CommandSuggester) ShouldSuggest(input string) bool
ShouldSuggest returns true if this suggester should provide suggestions
type Completer ¶
type Completer struct {
// contains filtered or unexported fields
}
Completer provides a clean, simple API for suggestions with complete key handling
func (*Completer) RegisterSuggester ¶
RegisterSuggester adds a suggester to the completer
type MockRegistryForTesting ¶
type MockRegistryForTesting struct {
// contains filtered or unexported fields
}
MockRegistryForTesting implements CommandRegistry interface for testing
func (*MockRegistryForTesting) GetCommandNames ¶
func (m *MockRegistryForTesting) GetCommandNames() []string
type MockSlashCommandManager ¶
type MockSlashCommandManager struct {
// contains filtered or unexported fields
}
MockSlashCommandManager implements SlashCommandManager interface for testing
func (*MockSlashCommandManager) GetCommandNames ¶
func (m *MockSlashCommandManager) GetCommandNames() []string
type MockSuggesterForTesting ¶
type MockSuggesterForTesting struct {
// contains filtered or unexported fields
}
MockSuggesterForTesting implements Suggester interface for testing
func (*MockSuggesterForTesting) GetPrefix ¶
func (m *MockSuggesterForTesting) GetPrefix() string
func (*MockSuggesterForTesting) GetSuggestions ¶
func (m *MockSuggesterForTesting) GetSuggestions(input string) []string
func (*MockSuggesterForTesting) ShouldSuggest ¶
func (m *MockSuggesterForTesting) ShouldSuggest(input string) bool
type Shell ¶
type Shell interface {
gocui.Editor // Embed gocui.Editor to handle character input and basic cursor movements
// GetInputBuffer returns the current content of the input buffer.
GetInputBuffer() string
// SetInputBuffer sets the content of the input buffer and updates the view.
SetInputBuffer(s string, v *gocui.View)
// ClearInput clears the input buffer and resets the view.
ClearInput(v *gocui.View)
NavigateHistoryUp(v *gocui.View)
NavigateHistoryDown(v *gocui.View)
ResetHistoryNavigation()
}
Shell defines the interface for our custom shell abstraction. It embeds gocui.Editor to handle direct input to a gocui.View.
type SlashCommandManager ¶
type SlashCommandManager interface {
GetCommandNames() []string
}
SlashCommandManager interface defines what the SlashCommandSuggester needs from a slash command manager
func CreateTestSlashCommandManager ¶
func CreateTestSlashCommandManager() SlashCommandManager
CreateTestSlashCommandManager creates a mock slash command manager for testing
type SlashCommandSuggester ¶
type SlashCommandSuggester struct {
// contains filtered or unexported fields
}
SlashCommandSuggester provides suggestions for slash commands (starting with /)
func NewSlashCommandSuggester ¶
func NewSlashCommandSuggester(manager SlashCommandManager) *SlashCommandSuggester
NewSlashCommandSuggester creates a new slash command suggester with a slash command manager
func (*SlashCommandSuggester) GetPrefix ¶
func (scs *SlashCommandSuggester) GetPrefix() string
GetPrefix returns the prefix this suggester handles
func (*SlashCommandSuggester) GetSuggestions ¶
func (scs *SlashCommandSuggester) GetSuggestions(input string) []string
GetSuggestions returns suggestions based on the current input
func (*SlashCommandSuggester) ShouldSuggest ¶
func (scs *SlashCommandSuggester) ShouldSuggest(input string) bool
ShouldSuggest returns true if this suggester should provide suggestions
type Suggester ¶
type Suggester interface {
// GetSuggestions returns suggestions for the given input
// Returns empty slice if no suggestions available
GetSuggestions(input string) []string
// ShouldSuggest returns true if this suggester should provide suggestions for the input
ShouldSuggest(input string) bool
// GetPrefix returns the prefix this suggester handles (e.g., ":", "/")
GetPrefix() string
}
Suggester provides suggestions based on input prefix