mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Remove return value of Alert/Confirm/Prompt
This might seem controversial; in many cases the client code gets longer, because it needs an extra line for an explicit `return nil`. I still prefer this, because it makes it clearer which calls can return errors.
This commit is contained in:
@ -118,7 +118,7 @@ func (self *HandlerCreator) inputPrompt(prompt *config.CustomCommandPrompt, wrap
|
||||
return err
|
||||
}
|
||||
|
||||
return self.c.Prompt(types.PromptOpts{
|
||||
self.c.Prompt(types.PromptOpts{
|
||||
Title: prompt.Title,
|
||||
InitialContent: prompt.InitialValue,
|
||||
FindSuggestionsFunc: findSuggestionsFn,
|
||||
@ -126,6 +126,8 @@ func (self *HandlerCreator) inputPrompt(prompt *config.CustomCommandPrompt, wrap
|
||||
return wrappedF(str)
|
||||
},
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *HandlerCreator) generateFindSuggestionsFunc(prompt *config.CustomCommandPrompt) (func(string) []*types.Suggestion, error) {
|
||||
@ -183,11 +185,13 @@ func (self *HandlerCreator) getPresetSuggestionsFn(preset string) (func(string)
|
||||
}
|
||||
|
||||
func (self *HandlerCreator) confirmPrompt(prompt *config.CustomCommandPrompt, handleConfirm func() error) error {
|
||||
return self.c.Confirm(types.ConfirmOpts{
|
||||
self.c.Confirm(types.ConfirmOpts{
|
||||
Title: prompt.Title,
|
||||
Prompt: prompt.Body,
|
||||
HandleConfirm: handleConfirm,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *HandlerCreator) menuPrompt(prompt *config.CustomCommandPrompt, wrappedF func(string) error) error {
|
||||
@ -298,7 +302,7 @@ func (self *HandlerCreator) finalHandler(customCommand config.CustomCommand, ses
|
||||
return err
|
||||
}
|
||||
}
|
||||
return self.c.Alert(title, output)
|
||||
self.c.Alert(title, output)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user