state

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 8 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 {
	Invocation  string `json:"i"`
	Description string `json:"d"`
	// contains filtered or unexported fields
}

Command is a fundamental unit that is some string that can be run in a shell along with additional metadata.

type Container

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

Container encapsulates the various states loaded.

func Init

func Init() (*Container, error)

Init initializes the state container, also loading in the primary state file.

func (*Container) DeleteCommand

func (c *Container) DeleteCommand(command *Command) error

DeleteCommand deletes the given command from the container.

func (*Container) Dump

func (c *Container) Dump()

Dump stores the contents of every state to disk.

func (*Container) Load

func (c *Container) Load(path string) error

Load loads the speeddial state at the given path into the provided container, creating a new one if one does not exist.

func (*Container) NewCommand

func (c *Container) NewCommand(invocation, desc string) error

NewCommand creates a new command in the primary state with the given invocation string and description.

func (*Container) Searcher

func (c *Container) Searcher() *Searcher

Searcher returns a Searcher over the container.

type Searcher

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

Searcher provides a searchable view over all commands. It conforms to the term.QueryableList interface

func (*Searcher) Search

func (s *Searcher) Search(rawQuery string) []term.ListItem

Search searches all state in this container based on the given query.

Jump to

Keyboard shortcuts

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