mirror of https://github.com/curusarn/resh
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
691 B
34 lines
691 B
package histcli
|
|
|
|
import (
|
|
"github.com/curusarn/resh/internal/recordint"
|
|
"github.com/curusarn/resh/record"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
// Histcli is a dump of history preprocessed for resh cli purposes
|
|
type Histcli struct {
|
|
// list of records
|
|
List []recordint.SearchApp
|
|
|
|
sugar *zap.SugaredLogger
|
|
}
|
|
|
|
// New Histcli
|
|
func New(sugar *zap.SugaredLogger) Histcli {
|
|
return Histcli{}
|
|
}
|
|
|
|
// AddRecord to the histcli
|
|
func (h *Histcli) AddRecord(rec *record.V1) {
|
|
cli := recordint.NewSearchApp(h.sugar, rec)
|
|
|
|
h.List = append(h.List, cli)
|
|
}
|
|
|
|
// AddCmdLine to the histcli
|
|
func (h *Histcli) AddCmdLine(cmdline string) {
|
|
cli := recordint.NewSearchAppFromCmdLine(cmdline)
|
|
|
|
h.List = append(h.List, cli)
|
|
}
|
|
|