command

package
v0.2.1-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name    string
	Aliases []string
	Help    string
	Hidden  bool // true = omitted from :help (easter egg commands)
	Execute func(args []string) tea.Cmd
}

Command represents a registered command.

type Parsed

type Parsed struct {
	Name string
	Args []string
}

Parsed represents a parsed command input.

func Parse

func Parse(input string) Parsed

Parse splits a command string like "build param1=val1" into name and args.

type Registry

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

Registry holds all registered commands.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty command registry.

func (*Registry) Execute

func (r *Registry) Execute(input string) (tea.Cmd, error)

Execute looks up and runs a command by name.

func (*Registry) List

func (r *Registry) List() []Command

List returns all unique commands (no alias duplicates).

func (*Registry) ListVisible

func (r *Registry) ListVisible() []Command

ListVisible returns all unique non-hidden commands.

func (*Registry) Register

func (r *Registry) Register(cmd Command)

Register adds a command to the registry.

func (*Registry) Suggest

func (r *Registry) Suggest(prefix string) []string

Suggest returns all non-hidden command names and aliases that start with prefix, excluding exact matches, sorted alphabetically.

Jump to

Keyboard shortcuts

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