1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
package controllers
import (
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
type FilterControllerFactory struct {
c *ControllerCommon
}
func NewFilterControllerFactory(c *ControllerCommon) *FilterControllerFactory {
return &FilterControllerFactory{
c: c,
}
}
func (self *FilterControllerFactory) Create(context types.IFilterableContext) *FilterController {
return &FilterController{
baseController: baseController{},
c: self.c,
context: context,
}
}
type FilterController struct {
baseController
c *ControllerCommon
context types.IFilterableContext
}
func (self *FilterController) Context() types.Context {
return self.context
}
func (self *FilterController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.StartSearch),
Handler: self.OpenFilterPrompt,
Description: self.c.Tr.StartFilter,
},
}
}
func (self *FilterController) OpenFilterPrompt() error {
return self.c.Helpers().Search.OpenFilterPrompt(self.context)
}
|