slot

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package slot defines the data structures for slot command storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Slot

type Slot struct {
	// Name is the unique identifier for the slot.
	Name string
	// Description provides a brief explanation of the slot's purpose.
	Description string `json:"description,omitempty"`
	// Cmd is the command template with placeholders.
	Cmd string
	// Vars are default template variables for this slot.
	Vars map[string]any `json:"vars,omitempty"`
	// Tags are optional labels for organizing slots.
	Tags []string `json:"tags,omitempty"`
}

Slot represents a saved command with metadata.

type Slots

type Slots []Slot

Slots is a slice of Slot structs.

func (*Slots) Add

func (s *Slots) Add(slot Slot)

Add adds a new slot.

func (Slots) Closest

func (s Slots) Closest(name string) string

Closest returns slot names ranked by similarity to the given name.

func (*Slots) Delete

func (s *Slots) Delete(name string) bool

Delete removes the slot with the specified name, returning true if found and deleted.

func (Slots) Exists

func (s Slots) Exists(name string) bool

Exists checks if a slot with the given name exists.

func (Slots) Get

func (s Slots) Get(name string) *Slot

Get retrieves a pointer to the slot with the specified name, or nil if not found.

func (Slots) Names

func (s Slots) Names() []string

Names returns a slice of all slot names.

func (Slots) Render

func (s Slots) Render(format string, writer io.Writer) error

Render outputs the slots in the specified format ("table" or "tsv") to the given writer.

func (Slots) Slice

func (s Slots) Slice(from, to int) Slots

Slice returns a new slots object containing slots from index 'from' to 'to'.

func (Slots) Unique added in v0.1.0

func (s Slots) Unique() Slots

Unique returns slots without duplicate names, keeping the first occurrence.

Jump to

Keyboard shortcuts

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