history

package
v0.0.0-...-c0b29db Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisableMarks = "\"'"
View Source
var Mark = "!"
View Source
var MaxSaveHistory = 1000

Functions

func CmdHistory

func CmdHistory(ctx context.Context, cmd Param, historyObj Dumper) (int, error)

func ExpandMacro

func ExpandMacro(buffer *strings.Builder, reader *strings.Reader, row *Line)

Types

type Container

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

Container has all history data.

func (*Container) At

func (c *Container) At(n int) string

func (*Container) DumpAt

func (c *Container) DumpAt(n int) string

func (*Container) GetAt

func (c *Container) GetAt(n int) *Line

At returns n-th history-text

func (*Container) IgnorePush

func (c *Container) IgnorePush(newvalue bool) bool

func (*Container) Len

func (c *Container) Len() int

Len returns size of history

func (*Container) Load

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

func (*Container) LoadViaReader

func (hisObj *Container) LoadViaReader(reader io.Reader)

func (*Container) Push

func (c *Container) Push(line string)

Push appends a new history line to self with string

func (*Container) PushLine

func (c *Container) PushLine(row Line)

PushLine appends a new history line to self with Line object

func (*Container) Replace

func (hisObj *Container) Replace(line string) (string, bool, error)

func (*Container) Save

func (hisObj *Container) Save(path string) error

func (*Container) SaveViaWriter

func (hisObj *Container) SaveViaWriter(w io.Writer)

type Dumper

type Dumper interface {
	Len() int
	DumpAt(int) string
}

type Line

type Line struct {
	Text  string
	Dir   string
	Stamp time.Time
	Pid   int
}

Line has one history data

func NewHistoryLine

func NewHistoryLine(text string) Line

NewHistoryLine returns new Line object with history-text

func (*Line) String

func (row *Line) String() string

String returns self as printable text

type Param

type Param interface {
	Arg(int) string
	Args() []string
	Out() io.Writer
	Err() io.Writer
}

Jump to

Keyboard shortcuts

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