2022-05-07 07:42:36 +02:00
|
|
|
package popup
|
|
|
|
|
2023-07-09 03:32:27 +02:00
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/gocui"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
|
|
|
)
|
2022-05-07 07:42:36 +02:00
|
|
|
|
|
|
|
type FakePopupHandler struct {
|
|
|
|
OnErrorMsg func(message string) error
|
|
|
|
OnConfirm func(opts types.ConfirmOpts) error
|
|
|
|
OnPrompt func(opts types.PromptOpts) error
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ types.IPopupHandler = &FakePopupHandler{}
|
|
|
|
|
|
|
|
func (self *FakePopupHandler) Error(err error) error {
|
|
|
|
return self.ErrorMsg(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *FakePopupHandler) ErrorMsg(message string) error {
|
|
|
|
return self.OnErrorMsg(message)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *FakePopupHandler) Alert(title string, message string) error {
|
|
|
|
panic("not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *FakePopupHandler) Confirm(opts types.ConfirmOpts) error {
|
2022-05-18 13:33:35 +02:00
|
|
|
return self.OnConfirm(opts)
|
2022-05-07 07:42:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (self *FakePopupHandler) Prompt(opts types.PromptOpts) error {
|
|
|
|
return self.OnPrompt(opts)
|
|
|
|
}
|
|
|
|
|
2023-07-09 13:09:52 +02:00
|
|
|
func (self *FakePopupHandler) WithLoaderPanel(message string, f func(gocui.Task) error) error {
|
|
|
|
return f(gocui.NewFakeTask())
|
2022-05-07 07:42:36 +02:00
|
|
|
}
|
|
|
|
|
2023-07-09 13:09:52 +02:00
|
|
|
func (self *FakePopupHandler) WithWaitingStatus(message string, f func(gocui.Task) error) error {
|
|
|
|
return f(gocui.NewFakeTask())
|
2022-05-07 07:42:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (self *FakePopupHandler) Menu(opts types.CreateMenuOptions) error {
|
|
|
|
panic("not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *FakePopupHandler) Toast(message string) {
|
|
|
|
panic("not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *FakePopupHandler) GetPromptInput() string {
|
|
|
|
panic("not yet implemented")
|
|
|
|
}
|