suggestions

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

OnAutoComplete is fired after the built-in autocomplete logic has run. Modules register handlers here to contribute completions for their own commands. Each handler receives the current request (including any results already accumulated by earlier handlers), may append to Results, and must return the modified value.

Example registration from a module:

suggestions.OnAutoComplete.Register(func(r suggestions.AutoCompleteRequest) suggestions.AutoCompleteRequest {
    if r.Cmd != "mycommand" {
        return r
    }
    // ... append to r.Results ...
    return r
})

Functions

func GetAutoComplete added in v0.9.8

func GetAutoComplete(userId int, inputText string) []string

GetAutoComplete returns a list of completion suffixes for the given partial input text. Each entry is the text that should be appended to inputText to form a complete suggestion. The results are sorted shortest-first.

Types

type AutoCompleteRequest added in v0.9.8

type AutoCompleteRequest struct {
	UserId  int
	Cmd     string
	Parts   []string
	Results []string
}

AutoCompleteRequest is the value threaded through OnAutoComplete handlers. Cmd is the resolved command (after alias expansion). Parts is the original whitespace-split input slice. UserId identifies the requesting player. Results is the accumulated completion suffix list; handlers append to it.

type Suggestions

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

func (*Suggestions) Clear

func (s *Suggestions) Clear()

func (*Suggestions) Count

func (s *Suggestions) Count() int

func (*Suggestions) Next

func (s *Suggestions) Next() string

func (*Suggestions) Set

func (s *Suggestions) Set(suggestions []string)

Jump to

Keyboard shortcuts

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