history

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEndOfHistory = errors.New("end of history")

Functions

func Init

func Init(ed eddefs.Editor, ns eval.Ns)

Types

type Fuser

type Fuser struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

Fuser provides a unified view into a shared storage-backed command history and per-session history.

func NewFuser

func NewFuser(store storedefs.Store) (*Fuser, error)

func (*Fuser) AddCmd

func (f *Fuser) AddCmd(cmd string) error

func (*Fuser) AllCmds

func (f *Fuser) AllCmds() ([]string, error)

func (*Fuser) FastForward

func (f *Fuser) FastForward() error

func (*Fuser) SessionCmds

func (f *Fuser) SessionCmds() []string

func (*Fuser) Walker

func (f *Fuser) Walker(prefix string) *Walker

type List

type List struct {
	*sync.RWMutex
}

List is a list-like value that provides access to history in the API backend. It is used in the $edit:history variable.

func (List) Equal

func (hv List) Equal(a interface{}) bool

Equal returns true as long as the rhs is also of type History.

func (List) Hash

func (hv List) Hash() uint32

func (List) Index

func (hv List) Index(rawIndex interface{}) (interface{}, error)

func (List) Iterate

func (hv List) Iterate(f func(interface{}) bool)

func (List) Kind

func (hv List) Kind() string

func (List) Len

func (hv List) Len() int

func (List) Repr

func (hv List) Repr(int) string

type Walker

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

Walker is used for walking through history entries with a given (possibly empty) prefix, skipping duplicates entries.

func NewWalker

func NewWalker(store storedefs.Store, upper int, cmds []string, seqs []int, prefix string) *Walker

func (*Walker) CurrentCmd

func (w *Walker) CurrentCmd() string

CurrentSeq returns the content of the current entry.

func (*Walker) CurrentSeq

func (w *Walker) CurrentSeq() int

CurrentSeq returns the sequence number of the current entry.

func (*Walker) Next

func (w *Walker) Next() (int, string, error)

Next reverses Prev.

func (*Walker) Prefix

func (w *Walker) Prefix() string

Prefix returns the prefix of the commands that the walker walks through.

func (*Walker) Prev

func (w *Walker) Prev() (int, string, error)

Prev walks to the previous matching history entry, skipping all duplicates.

Jump to

Keyboard shortcuts

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