Documentation
¶
Index ¶
- func NewCompgenCommandHandler(runner *interp.Runner) func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc
- func NewCompleteCommandHandler(completionManager *CompletionManager) func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc
- type CompletionFunction
- type CompletionManager
- func (m *CompletionManager) AddSpec(spec CompletionSpec)
- func (m *CompletionManager) ExecuteCompletion(ctx context.Context, runner *interp.Runner, spec CompletionSpec, args []string, ...) ([]shellinput.CompletionCandidate, error)
- func (m *CompletionManager) GetSpec(command string) (CompletionSpec, bool)
- func (m *CompletionManager) ListSpecs() []CompletionSpec
- func (m *CompletionManager) RemoveSpec(command string)
- func (m *CompletionManager) RunExternalCompleter(ctx context.Context, command string, args []string, line string, pos int) ([]shellinput.CompletionCandidate, error)
- type CompletionManagerInterface
- type CompletionSpec
- type CompletionType
- type DefaultCompleter
- type GitCompleter
- type ShellCompletionProvider
- type StaticCompleter
- func (s *StaticCompleter) GetCompletions(command string, args []string) []shellinput.CompletionCandidate
- func (s *StaticCompleter) GetRegisteredCommands() []string
- func (s *StaticCompleter) HasCommand(command string) bool
- func (s *StaticCompleter) RegisterUserCommand(command string, subcommands []UserCompletion)
- func (s *StaticCompleter) ReloadUserCompletions()
- type SubagentInfo
- type SubagentProvider
- type UserCompletion
- type UserCompletionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCompgenCommandHandler ¶
func NewCompgenCommandHandler(runner *interp.Runner) func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc
NewCompgenCommandHandler creates a new ExecHandler for the compgen command
func NewCompleteCommandHandler ¶
func NewCompleteCommandHandler(completionManager *CompletionManager) func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc
NewCompleteCommandHandler creates a new ExecHandler for the complete command
Types ¶
type CompletionFunction ¶
CompletionFunction represents a bash completion function
func NewCompletionFunction ¶
func NewCompletionFunction(name string, runner *interp.Runner) *CompletionFunction
NewCompletionFunction creates a new CompletionFunction
type CompletionManager ¶
type CompletionManager struct {
// contains filtered or unexported fields
}
CompletionManager manages command completion specifications
func NewCompletionManager ¶
func NewCompletionManager() *CompletionManager
NewCompletionManager creates a new CompletionManager
func (*CompletionManager) AddSpec ¶
func (m *CompletionManager) AddSpec(spec CompletionSpec)
AddSpec adds or updates a completion specification
func (*CompletionManager) ExecuteCompletion ¶
func (m *CompletionManager) ExecuteCompletion(ctx context.Context, runner *interp.Runner, spec CompletionSpec, args []string, line string, pos int) ([]shellinput.CompletionCandidate, error)
ExecuteCompletion executes a completion specification for a given command line and returns the list of possible completions
func (*CompletionManager) GetSpec ¶
func (m *CompletionManager) GetSpec(command string) (CompletionSpec, bool)
GetSpec retrieves a completion specification
func (*CompletionManager) ListSpecs ¶
func (m *CompletionManager) ListSpecs() []CompletionSpec
ListSpecs returns all completion specifications
func (*CompletionManager) RemoveSpec ¶
func (m *CompletionManager) RemoveSpec(command string)
RemoveSpec removes a completion specification
func (*CompletionManager) RunExternalCompleter ¶
func (m *CompletionManager) RunExternalCompleter(ctx context.Context, command string, args []string, line string, pos int) ([]shellinput.CompletionCandidate, error)
RunExternalCompleter executes an external command to generate completions
type CompletionManagerInterface ¶
type CompletionManagerInterface interface {
GetSpec(command string) (CompletionSpec, bool)
ExecuteCompletion(ctx context.Context, runner *interp.Runner, spec CompletionSpec, args []string, line string, pos int) ([]shellinput.CompletionCandidate, error)
}
CompletionManagerInterface defines the interface for completion management
type CompletionSpec ¶
type CompletionSpec struct {
Command string
Type CompletionType
Value string // function name, wordlist, or command
Options []string // additional options like -o dirname
}
CompletionSpec represents a completion specification for a command
type CompletionType ¶
type CompletionType string
CompletionType represents the type of completion
const ( // WordListCompletion represents word list based completion (-W option) WordListCompletion CompletionType = "W" // FunctionCompletion represents function based completion (-F option) FunctionCompletion CompletionType = "F" // CommandCompletion represents command based completion (-C option) CommandCompletion CompletionType = "C" )
type DefaultCompleter ¶
type DefaultCompleter struct{}
DefaultCompleter handles built-in default completions for common commands
func (*DefaultCompleter) GetCompletions ¶
func (d *DefaultCompleter) GetCompletions(command string, args []string, line string, pos int) ([]shellinput.CompletionCandidate, bool)
GetCompletions tries to provide completions for the given command and context
type GitCompleter ¶
type GitCompleter struct{}
GitCompleter handles built-in completion for git
func (*GitCompleter) GetCompletions ¶
func (g *GitCompleter) GetCompletions(args []string, line string) []shellinput.CompletionCandidate
type ShellCompletionProvider ¶
type ShellCompletionProvider struct {
CompletionManager CompletionManagerInterface
Runner *interp.Runner
SubagentProvider SubagentProvider // Optional, for # completions
// contains filtered or unexported fields
}
ShellCompletionProvider implements shellinput.CompletionProvider using the shell's CompletionManager
func NewShellCompletionProvider ¶
func NewShellCompletionProvider(manager CompletionManagerInterface, runner *interp.Runner) *ShellCompletionProvider
NewShellCompletionProvider creates a new ShellCompletionProvider
func (*ShellCompletionProvider) GetCompletions ¶
func (p *ShellCompletionProvider) GetCompletions(line string, pos int) []shellinput.CompletionCandidate
GetCompletions returns completion suggestions for the current input line
func (*ShellCompletionProvider) GetHelpInfo ¶
func (p *ShellCompletionProvider) GetHelpInfo(line string, pos int) string
GetHelpInfo returns help information for special commands like #!, #/, and #
func (*ShellCompletionProvider) SetSubagentProvider ¶
func (p *ShellCompletionProvider) SetSubagentProvider(provider SubagentProvider)
SetSubagentProvider sets the subagent provider for # completions
type StaticCompleter ¶
type StaticCompleter struct {
// contains filtered or unexported fields
}
StaticCompleter handles static word lists for common commands
func NewStaticCompleter ¶
func NewStaticCompleter() *StaticCompleter
func (*StaticCompleter) GetCompletions ¶
func (s *StaticCompleter) GetCompletions(command string, args []string) []shellinput.CompletionCandidate
GetCompletions returns completion suggestions for a command
func (*StaticCompleter) GetRegisteredCommands ¶ added in v0.32.0
func (s *StaticCompleter) GetRegisteredCommands() []string
GetRegisteredCommands returns a sorted list of all commands that have static completions
func (*StaticCompleter) HasCommand ¶ added in v0.32.0
func (s *StaticCompleter) HasCommand(command string) bool
HasCommand returns true if the command has registered completions
func (*StaticCompleter) RegisterUserCommand ¶ added in v0.32.0
func (s *StaticCompleter) RegisterUserCommand(command string, subcommands []UserCompletion)
RegisterUserCommand allows users to register custom command completions at runtime
func (*StaticCompleter) ReloadUserCompletions ¶ added in v0.32.0
func (s *StaticCompleter) ReloadUserCompletions()
ReloadUserCompletions reloads user-defined completions from config files
type SubagentInfo ¶
type SubagentInfo struct {
ID string
Name string
Description string
AllowedTools []string
FileRegex string
Model string
}
SubagentInfo represents minimal information about a subagent for completion purposes
type SubagentProvider ¶
type SubagentProvider interface {
GetAllSubagents() map[string]*SubagentInfo
GetSubagent(id string) (*SubagentInfo, bool)
}
SubagentProvider defines the interface for providing subagent information to the completion system
type UserCompletion ¶ added in v0.32.0
type UserCompletion struct {
Value string `yaml:"value" json:"value"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
}
UserCompletion represents a single user-defined completion entry
type UserCompletionConfig ¶ added in v0.32.0
type UserCompletionConfig struct {
Commands map[string][]UserCompletion `yaml:"commands" json:"commands"`
}
UserCompletionConfig represents user-defined completion configuration