command

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package command provides a persistent store for saved bash commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultStorePath

func DefaultStorePath() (string, error)

DefaultStorePath returns the default path for the commands JSON file.

Types

type Store

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

Store persists saved commands as a single JSON file.

func NewStore

func NewStore(fs fileSystem, storagePath string) *Store

NewStore creates a command store backed by a JSON file.

func (*Store) Delete

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

Delete removes a saved command by name. Returns true if it existed.

func (*Store) DeleteAll

func (s *Store) DeleteAll()

DeleteAll removes all saved commands.

func (*Store) Get

func (s *Store) Get(name string) (*domain.SavedCommand, bool)

Get returns a saved command by name.

func (*Store) List

func (s *Store) List() []*domain.SavedCommand

List returns all saved commands sorted by name.

func (*Store) Save

func (s *Store) Save(name, command, description string) error

Save stores a command by name, creating or overwriting.

Jump to

Keyboard shortcuts

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