history

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2018 License: BSD-2-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 added in v0.12.0

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 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 added in v0.12.0

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 added in v0.11.0

type List struct {
	*sync.RWMutex
	Daemon *daemon.Client
}

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 added in v0.11.0

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

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

func (List) Hash added in v0.11.0

func (hv List) Hash() uint32

func (List) Index added in v0.12.0

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

func (List) Iterate added in v0.11.0

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

func (List) Kind added in v0.11.0

func (hv List) Kind() string

func (List) Len added in v0.11.0

func (hv List) Len() int

func (List) Repr added in v0.11.0

func (hv List) Repr(int) string

type Store

type Store interface {
	NextCmdSeq() (int, error)
	AddCmd(cmd string) (int, error)
	Cmds(from, upto int) ([]string, error)
	PrevCmd(upto int, prefix string) (int, string, error)
}

Store is the interface of the storage backend.

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 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