store

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoVar = errors.New("no such variable")

ErrNoVar is returned by (*Store).GetSharedVar when there is no such variable.

Functions

func NewCmdHistory

func NewCmdHistory(s ...string) storedefs.Store

func NewSharedVar

func NewSharedVar() *shared

Types

type CmdHistory

type CmdHistory struct {
	sync.Mutex
	// contains filtered or unexported fields
}

The numbering is 1-based, not 0-based. Oh well.

func (*CmdHistory) Add

func (history *CmdHistory) Add(cmd string) (int, error)

AddCmd adds a new command to the command history.

func (*CmdHistory) Cur

func (history *CmdHistory) Cur() (int, error)

convenience functions

func (*CmdHistory) List

func (history *CmdHistory) List(from, upto int) ([]string, error)

Cmds returns the contents of all commands within the specified range.

func (*CmdHistory) Next

func (history *CmdHistory) Next() (int, error)

func (*CmdHistory) One

func (history *CmdHistory) One(seq int) (string, error)

Cmd queries the command history item with the specified sequence number.

func (*CmdHistory) Prev

func (history *CmdHistory) Prev() (int, error)

func (*CmdHistory) RSearch

func (history *CmdHistory) RSearch(upto int, prefix string) (int, string, error)

PrevCmd finds the last command before the given sequence number (exclusive) with the given prefix.

func (*CmdHistory) Remove

func (history *CmdHistory) Remove(seq int) error

Remove removes a command from command history referenced by sequence.

func (*CmdHistory) Search

func (history *CmdHistory) Search(from int, prefix string) (int, string, error)

Search finds the first command after the given sequence number (inclusive) with the given prefix.

func (*CmdHistory) Seek

func (history *CmdHistory) Seek(i int) (int, error)

func (*CmdHistory) Walk

func (history *CmdHistory) Walk(from, upto int, f func(string) bool) error

IterateCmds iterates all the commands in the specified range, and calls the callback with the content of each command sequentially.

type Dir

type Dir struct {
	Score float64
	Name  string
}

type DirHistory

type DirHistory struct {
	sync.Mutex
}

func (*DirHistory) AddDir

func (*DirHistory) AddDir(d string, incFactor float64) error

AddDir adds a directory to the directory history.

func (*DirHistory) AddDirRaw

func (s *DirHistory) AddDirRaw(d string, score float64) error

AddDir adds a directory and its score to history.

func (*DirHistory) DelDir

func (s *DirHistory) DelDir(d string) error

DelDir deletes a directory record from history.

func (*DirHistory) Dirs

func (s *DirHistory) Dirs(blocklist map[string]struct{}) ([]storedefs.Dir, error)

Dirs lists all directories in the directory history whose names are not in the blocklist. The results are ordered by scores in descending order.

Directories

Path Synopsis
Package storedefs contains definitions used by the store package.
Package storedefs contains definitions used by the store package.

Jump to

Keyboard shortcuts

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