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) ([]string, error)
- func (m *CompletionManager) GetSpec(command string) (CompletionSpec, bool)
- func (m *CompletionManager) ListSpecs() []CompletionSpec
- func (m *CompletionManager) RemoveSpec(command string)
- type CompletionManagerInterface
- type CompletionSpec
- type CompletionType
- type ShellCompletionProvider
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) ([]string, 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
type CompletionManagerInterface ¶
type CompletionManagerInterface interface {
GetSpec(command string) (CompletionSpec, bool)
ExecuteCompletion(ctx context.Context, runner *interp.Runner, spec CompletionSpec, args []string) ([]string, error)
}
CompletionManagerInterface defines the interface for completion management
type CompletionSpec ¶
type CompletionSpec struct {
Command string
Type CompletionType
Value string // function name or wordlist
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" )
type ShellCompletionProvider ¶
type ShellCompletionProvider struct {
CompletionManager CompletionManagerInterface
Runner *interp.Runner
}
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) []string
GetCompletions returns completion suggestions for the current input line
func (*ShellCompletionProvider) GetHelpInfo ¶ added in v0.23.0
func (p *ShellCompletionProvider) GetHelpInfo(line string, pos int) string
GetHelpInfo returns help information for special commands like #! and #/