storage

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 5 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 {
	Text      string    `json:"text"`
	CreatedAt time.Time `json:"created_at"`
	UseCount  int       `json:"use_count"`
}

Command represents a saved command with metadata

type Storage

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

Storage handles saving and loading commands

func New

func New() (*Storage, error)

New creates a new Storage instance

func (*Storage) Add

func (s *Storage) Add(text string) error

Add appends a new command to storage

func (*Storage) IncrementUse added in v0.1.3

func (s *Storage) IncrementUse(text string) error

IncrementUse increases the use count for a command

func (*Storage) List

func (s *Storage) List() ([]string, error)

List returns all command texts sorted by usage (most used first)

func (*Storage) Load

func (s *Storage) Load() ([]Command, error)

Load reads all commands from storage

func (*Storage) Remove

func (s *Storage) Remove(text string) error

Remove deletes a command from storage

func (*Storage) Save

func (s *Storage) Save(commands []Command) error

Save writes all commands to storage

func (*Storage) Update added in v0.2.9

func (s *Storage) Update(oldText, newText string) error

Update replaces old command text with new text, preserving metadata

Jump to

Keyboard shortcuts

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