1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00
lazygit/pkg/gui/controllers/helpers/bisect_helper.go

41 lines
890 B
Go
Raw Normal View History

2022-02-06 06:54:26 +02:00
package helpers
2022-01-30 01:40:48 +02:00
import (
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
type BisectHelper struct {
2022-02-06 06:54:26 +02:00
c *types.HelperCommon
2022-01-30 01:40:48 +02:00
git *commands.GitCommand
}
func NewBisectHelper(
2022-02-06 06:54:26 +02:00
c *types.HelperCommon,
2022-01-30 01:40:48 +02:00
git *commands.GitCommand,
) *BisectHelper {
return &BisectHelper{
c: c,
git: git,
}
}
func (self *BisectHelper) Reset() error {
return self.c.Ask(types.AskOpts{
Title: self.c.Tr.Bisect.ResetTitle,
Prompt: self.c.Tr.Bisect.ResetPrompt,
HandleConfirm: func() error {
self.c.LogAction(self.c.Tr.Actions.ResetBisect)
if err := self.git.Bisect.Reset(); err != nil {
return self.c.Error(err)
}
return self.PostBisectCommandRefresh()
},
})
}
func (self *BisectHelper) PostBisectCommandRefresh() error {
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{}})
}