Documentation
¶
Index ¶
- type History
- func (h *History) Add(message string) error
- func (h *History) FindNextContains(query string, from int) (msg string, idx int, ok bool)
- func (h *History) FindPrevContains(query string, from int) (msg string, idx int, ok bool)
- func (h *History) LatestMatch(prefix string) string
- func (h *History) Next() string
- func (h *History) Previous() string
- func (h *History) SetCurrent(i int)
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type History ¶
type History struct {
Messages []string `json:"messages"`
// contains filtered or unexported fields
}
func (*History) FindNextContains ¶ added in v1.22.0
FindNextContains searches forward through history for a message containing query. from is an exclusive lower bound index. Pass -1 to start from the oldest. Returns the matched message, its index, and whether a match was found.
func (*History) FindPrevContains ¶ added in v1.22.0
FindPrevContains searches backward through history for a message containing query. from is an exclusive upper bound index. Pass len(Messages) to start from the most recent. Returns the matched message, its index, and whether a match was found. An empty query matches any entry.
func (*History) LatestMatch ¶ added in v1.8.2
LatestMatch returns the most recent history entry that extends the provided prefix, or the latest message when no prefix is supplied.