mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
start moving commit panel handlers into controller
more and more move rebase commit refreshing into existing abstraction and more and more WIP and more handling clicks properly fix merge conflicts update cheatsheet lots more preparation to start moving things into controllers WIP better typing expand on remotes controller moving more code into controllers
This commit is contained in:
@ -19,6 +19,8 @@ type IPopupHandler interface {
|
||||
WithLoaderPanel(message string, f func() error) error
|
||||
WithWaitingStatus(message string, f func() error) error
|
||||
Menu(opts CreateMenuOptions) error
|
||||
Toast(message string)
|
||||
GetPromptInput() string
|
||||
}
|
||||
|
||||
type CreateMenuOptions struct {
|
||||
@ -74,6 +76,8 @@ type RealPopupHandler struct {
|
||||
closePopupFn func() error
|
||||
createMenuFn func(CreateMenuOptions) error
|
||||
withWaitingStatusFn func(message string, f func() error) error
|
||||
toastFn func(message string)
|
||||
getPromptInputFn func() string
|
||||
}
|
||||
|
||||
var _ IPopupHandler = &RealPopupHandler{}
|
||||
@ -85,6 +89,8 @@ func NewPopupHandler(
|
||||
closePopupFn func() error,
|
||||
createMenuFn func(CreateMenuOptions) error,
|
||||
withWaitingStatusFn func(message string, f func() error) error,
|
||||
toastFn func(message string),
|
||||
getPromptInputFn func() string,
|
||||
) *RealPopupHandler {
|
||||
return &RealPopupHandler{
|
||||
Common: common,
|
||||
@ -94,6 +100,8 @@ func NewPopupHandler(
|
||||
closePopupFn: closePopupFn,
|
||||
createMenuFn: createMenuFn,
|
||||
withWaitingStatusFn: withWaitingStatusFn,
|
||||
toastFn: toastFn,
|
||||
getPromptInputFn: getPromptInputFn,
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +109,10 @@ func (self *RealPopupHandler) Menu(opts CreateMenuOptions) error {
|
||||
return self.createMenuFn(opts)
|
||||
}
|
||||
|
||||
func (self *RealPopupHandler) Toast(message string) {
|
||||
self.toastFn(message)
|
||||
}
|
||||
|
||||
func (self *RealPopupHandler) WithWaitingStatus(message string, f func() error) error {
|
||||
return self.withWaitingStatusFn(message, f)
|
||||
}
|
||||
@ -188,6 +200,12 @@ func (self *RealPopupHandler) WithLoaderPanel(message string, f func() error) er
|
||||
return nil
|
||||
}
|
||||
|
||||
// returns the content that has currently been typed into the prompt. Useful for
|
||||
// asyncronously updating the suggestions list under the prompt.
|
||||
func (self *RealPopupHandler) GetPromptInput() string {
|
||||
return self.getPromptInputFn()
|
||||
}
|
||||
|
||||
type TestPopupHandler struct {
|
||||
OnErrorMsg func(message string) error
|
||||
OnAsk func(opts AskOpts) error
|
||||
@ -221,3 +239,11 @@ func (self *TestPopupHandler) WithWaitingStatus(message string, f func() error)
|
||||
func (self *TestPopupHandler) Menu(opts CreateMenuOptions) error {
|
||||
panic("not yet implemented")
|
||||
}
|
||||
|
||||
func (self *TestPopupHandler) Toast(message string) {
|
||||
panic("not yet implemented")
|
||||
}
|
||||
|
||||
func (self *TestPopupHandler) CurrentInput() string {
|
||||
panic("not yet implemented")
|
||||
}
|
||||
|
Reference in New Issue
Block a user