mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 18:07:51 +08:00
cli: Move StartHistlist to histlist_mode.go.
This commit is contained in:
parent
67f4027013
commit
974407ca10
|
@ -23,20 +23,3 @@ func DefaultInsert(ev KeyEvent) {
|
|||
ev.CommitEOF()
|
||||
}
|
||||
}
|
||||
|
||||
// StartHistlist starts the history listing mode.
|
||||
func StartHistlist(ev KeyEvent) {
|
||||
historyStore := ev.App().cfg.HistoryStore
|
||||
if historyStore == nil {
|
||||
ev.State().AddNote("no history store")
|
||||
return
|
||||
}
|
||||
cmds, err := historyStore.AllCmds()
|
||||
if err != nil {
|
||||
ev.State().AddNote("db error: " + err.Error())
|
||||
return
|
||||
}
|
||||
mode := ev.App().histlist
|
||||
mode.Start(cmds)
|
||||
ev.State().SetMode(mode)
|
||||
}
|
||||
|
|
|
@ -5,3 +5,20 @@ package cli
|
|||
type HistlistModeConfig struct {
|
||||
Binding Binding
|
||||
}
|
||||
|
||||
// StartHistlist starts the history listing mode.
|
||||
func StartHistlist(ev KeyEvent) {
|
||||
historyStore := ev.App().cfg.HistoryStore
|
||||
if historyStore == nil {
|
||||
ev.State().AddNote("no history store")
|
||||
return
|
||||
}
|
||||
cmds, err := historyStore.AllCmds()
|
||||
if err != nil {
|
||||
ev.State().AddNote("db error: " + err.Error())
|
||||
return
|
||||
}
|
||||
mode := ev.App().histlist
|
||||
mode.Start(cmds)
|
||||
ev.State().SetMode(mode)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user