completion

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package completion provides auto-completion for commands and suggestions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgSpec

type ArgSpec struct {
	Name        string
	Description string
	Required    bool
	Options     []string // Valid options if limited
}

ArgSpec describes a command argument.

type Command

type Command struct {
	Name        string
	Description string
	Aliases     []string
	Arguments   []ArgSpec
}

Command represents a slash command for completion.

func DefaultCommands

func DefaultCommands() []Command

DefaultCommands returns the default set of slash commands.

type Completion

type Completion struct {
	Value       string // The completed text
	Display     string // Display text (if different from value)
	Description string // Optional description
	MatchIndex  int    // Index where match starts
}

Completion represents a completion suggestion.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages multiple completion providers.

func NewManager

func NewManager() *Manager

NewManager creates a new completion manager.

func (*Manager) Complete

func (m *Manager) Complete(input string, cursorCol int) []Completion

Complete returns completions for the given input.

func (*Manager) RegisterCommand

func (m *Manager) RegisterCommand(cmd Command)

RegisterCommand registers a slash command.

func (*Manager) RegisterProvider

func (m *Manager) RegisterProvider(name string, p Provider)

RegisterProvider registers a completion provider.

type Provider

type Provider interface {
	Complete(prefix string) []Completion
}

Provider provides completion suggestions.

Jump to

Keyboard shortcuts

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